KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm fooling around with Ruby and basically I have @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 like when using Internationalizations I18n.t('something.other.foo') sofar I came up with this approach def t(key) a='' key.to_s.split('.').each{|key| a+="[:#{key}]" } #now a == "[:links][:quick_notes]" #but I cant figure out how can I call it on @trans variable end t('links.quick_notes') Any ideas ? thanx
Tags (comma-separated)
Save Edits
Cancel