Class: I18nFactory::Generators::UpdateGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/update_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_localeObject

Returns the value of attribute current_locale.



8
9
10
# File 'lib/generators/update_generator.rb', line 8

def current_locale
  @current_locale
end

#defined_columnsObject

Returns the value of attribute defined_columns.



8
9
10
# File 'lib/generators/update_generator.rb', line 8

def defined_columns
  @defined_columns
end

#defined_model_name_humanObject

Returns the value of attribute defined_model_name_human.



8
9
10
# File 'lib/generators/update_generator.rb', line 8

def defined_model_name_human
  @defined_model_name_human
end

Instance Method Details

#update_i18_fileObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/generators/update_generator.rb', line 15

def update_i18_file
  I18nFactory::Locale.all.each do |locale|
    self.current_locale = locale
    load_yaml_on(locale)
    if complex?
      template 'plain.yml.erb', path_for_i18n(locale), force: true
    else
      template 'i18n.yml.erb', path_for_i18n(locale), force: true
    end
  end
end