Method: Hash#vsort

Defined in:
lib/theusual/hash.rb

#vsort(&block) ⇒ Object



127
128
129
130
131
132
133
134
135
136
137
# File 'lib/theusual/hash.rb', line 127

def vsort(&block)
  Hash[
    sort_by do |k, v|
      if block
        yield v
      else
        v
      end
    end
  ]
end