Skip to content

Instantly share code, notes, and snippets.

@serialhex
Created July 27, 2011 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serialhex/1109300 to your computer and use it in GitHub Desktop.
Save serialhex/1109300 to your computer and use it in GitHub Desktop.
# ... snip
NArray.class_eval do
def sign
a = []
self.each do |x|
a << x.sign
end
a
end
def eql_items? other
raise(ArgumentError, "Argument is not an Array") unless other.kind_of? NArray
raise(ArgumentError, "Arrays dont' have the same number of elements") if self.size != other.size
output = []
self.each_with_index do |x, i|
output[i] = x == other[i]
end
return output
end
end
# ... snip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment