Module: I18nYamlGenerator::Helpers
- Included in:
- I18nYaml::Generators::ModelGenerator, I18nYaml::Generators::ScaffoldControllerGenerator
- Defined in:
- lib/i18n_yaml_generator/helpers.rb
Instance Method Summary collapse
Instance Method Details
#comment_yaml_body(string) ⇒ Object
11 12 13 14 15 |
# File 'lib/i18n_yaml_generator/helpers.rb', line 11 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) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/i18n_yaml_generator/helpers.rb', line 3 def wrap_hash(obj, scope) hsh = nil scope.reverse.each do |scope_node| hsh = { scope_node => hsh || obj } end return hsh end |