Displaying 2 results from an estimated 2 matches for "yaml_str".
Did you mean:
name_str
2009 Jan 28
6
Creating an object from a pp string?
When I use pp on an object in rails, it prints out a nice string
representation of the object. I am trying to pass objects from one
server to another and I am wondering if I can just pass this string and
create an object on the other server. Any libraries/functions out there
that can do this? Or any other way to do this (not necessarily using
pp).
Thanks!
--
Posted via
2010 Feb 16
7
YAML, UTF-8, TextMate, Notepad
...so that YAML::load works
AVAILABLE_LOCALES.each do |localization_name|
# localization_name is, e.g. "de"
localization_name_dot_yml = localization_name + ''.yml''
localization_file_name =
File.join(''lib/locale'',localization_name_dot_yml)
yaml_str = IO.read(localization_file_name)
utf_8__3_byte_indicator = "\xEF\xBB\xBF"
if yaml_str[0..2] == utf_8__3_byte_indicator
yaml_str = yaml_str[3...yaml_str.size]
File.open(localization_file_name,"w") { |f| f << yaml_str }
puts localization_file_name...