Class: Autochthon::Web

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/autochthon/web.rb

Instance Method Summary collapse

Instance Method Details

#expand_translation(key, value) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/autochthon/web.rb', line 16

def expand_translation(key, value)
  keys = key.split(I18n::Backend::Flatten::FLATTEN_SEPARATOR)

  keys[0...-1].reverse.inject(keys.last => value) do |out, k|
    {k => out}
  end
end

#jsonObject



12
13
14
# File 'lib/autochthon/web.rb', line 12

def json
  @json ||= JSON.parse(request.body.read, symbolize_names: true)
end