I cheat on Ruby and mostly mine
@trans = { :links => { :quick_notes => "aaaaaaa" } }
I want to call something like
def t #...something end t('links.quick_notes')
to access
trans[:links][:quick_notes]
I'm basically trying to achieve the same functionality as when using internationalization
I18n.t('something.other.foo')
sofar I came up with this approach
def t(key) a='' key.to_s.split('.').each{|key| a+="[:#{key}]" }
Any ideas? thanks
ruby hash
equivalent8
source share