Class: Object

Inherits:
BasicObject
Defined in:
lib/equal_rights_for_hash.rb

Instance Method Summary collapse

Instance Method Details

#to_hObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/equal_rights_for_hash.rb', line 8

def to_h
  if respond_to? :to_hash
    to_hash
  elsif respond_to? :to_ary and not all? {|item|
    item.respond_to? :to_ary and item.size <= 2 }
  then
    Hash[*self]
  else
    Hash[self]
  end
end