Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/bundix/nixer.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object

regretfully, duckpunching



5
6
7
8
9
10
11
12
13
# File 'lib/bundix/nixer.rb', line 5

def <=>(other)
  if other.is_a?(Hash)
    larray = to_a.sort{|l,r| Bundix::Nixer.order(l,r)}
    rarray = other.to_a.sort{|l,r| Bundix::Nixer.order(l,r)}
    larray <=> rarray
  else
    nil
  end
end