Method: InplaceI18n::HashTools#update_by_path
- Defined in:
- lib/inplace_i18n/hash_tools.rb
#update_by_path(path, string) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/inplace_i18n/hash_tools.rb', line 14 def update_by_path(path, string) return false if find_by_path(path).class == "Hash" create_path_if_not_exist(path) e ="self" path_a = path_to_a(path) path_a.each{|i| e = e+"['"+escape_for_eval(i)+"']" } string = string.gsub(/^[ \t]+/,"") string = escape_for_eval(string) e = e+"='"+string+"'" begin eval(e) return true rescue => e return [false, e] end end |