Module: ToolsForLocales

Defined in:
lib/tools_for_locales.rb,
lib/tools_for_locales/railtie.rb,
lib/tools_for_locales/version.rb

Defined Under Namespace

Classes: Railtie

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#sort_hash(hash) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/tools_for_locales.rb', line 5

def sort_hash(hash)
  hash = Hash[hash.sort]
  hash.inject({}) do |h, (key, value)|
    if value.is_a? Hash
      h[key] = sort_hash(value)
    else
      h[key] = value
    end
    h
  end
end