Class: ActionMessageTexter::Generators::TexterGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- ActionMessageTexter::Generators::TexterGenerator
- Defined in:
- lib/generators/action_message_texter/texter_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_application_texter ⇒ Object
13 14 15 16 17 |
# File 'lib/generators/action_message_texter/texter_generator.rb', line 13 def create_application_texter unless File.exist?('app/texter/application_texter.rb') template '../templetes/application_texter.rb', File.join('app/texter', 'application_texter.rb') end end |
#create_locale_yml ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/generators/action_message_texter/texter_generator.rb', line 23 def create_locale_yml @yaml = {} default_locale = I18n.default_locale.to_s scope_name = "#{file_name}_texter" @yaml[default_locale] = {} @yaml[default_locale][scope_name] = {} actions.each do |action| @yaml[default_locale][scope_name][action] = "#{action} message" end template '../templates/I18n.yml.rb', File.join('config/locales/texter', "#{file_name}_texter.yml") end |
#create_texter ⇒ Object
19 20 21 |
# File 'lib/generators/action_message_texter/texter_generator.rb', line 19 def create_texter template '../templates/texter.rb', File.join('app/texter', "#{file_name}_texter.rb") end |