hash with keys sorted by name add Hash.sym_keys
11 12 13
# File 'lib/hash.rb', line 11 def sort_by_key keys.sort.to_h { |key| [key, self[key]] } end
17 18 19
# File 'lib/hash.rb', line 17 def sym_keys transform_keys(&:to_sym) end