Method: Hash#+

Defined in:
lib/hash_vector.rb

#+(vector) ⇒ Object



7
8
9
10
# File 'lib/hash_vector.rb', line 7

def +(vector)
  return {:x => self[:x] + vector[:x], :y => self[:y] + vector[:y]} if vector.kind_of? Hash
  {:x => self[:x] + vector[0,0], :y => self[:y] + vector[1,0]}
end