Class: Hash

Inherits:
Object show all
Defined in:
lib/hash.rb

Overview

hash with keys sorted by name add Hash.sym_keys

Instance Method Summary collapse

Instance Method Details

#sort_by_keyObject



11
12
13
# File 'lib/hash.rb', line 11

def sort_by_key
  keys.sort.to_h { |key| [key, self[key]] }
end

#sym_keysObject



17
18
19
# File 'lib/hash.rb', line 17

def sym_keys
  transform_keys(&:to_sym)
end