module Rails::I18n::Generator::Helpers

Public Instance Methods

comment_yaml_body(string) click to toggle source
# File lib/rails/i18n/generator/helpers.rb, line 13
def comment_yaml_body(string)
  lines = string.lines.to_a
  new_lines = lines[0..1] + lines[2..-1].collect{ |line| line.gsub(/^(.?)/, '#\1') }
  new_lines.join
end
wrap_hash(obj, scope) click to toggle source
# File lib/rails/i18n/generator/helpers.rb, line 5
def wrap_hash(obj, scope)
  hsh = nil
  scope.reverse.each do |scope_node|
    hsh = { scope_node => hsh || obj }
  end
  return hsh
end