Class: Uncouple::Generators::Action
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Uncouple::Generators::Action
- Defined in:
- lib/uncouple/rails/generators/action_generator.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/uncouple/rails/generators/action_generator.rb', line 7 def name @name end |
Instance Method Details
#action_generator ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/uncouple/rails/generators/action_generator.rb', line 11 def action_generator self.name = args.first.to_s.downcase raise "Invalid Action Name" if name.blank? template "app/actions/action.rb", "app/actions/#{name}_action.rb" if defined?(RSpec) template "spec/actions/action_spec.rb", "spec/actions/#{name}_action_spec.rb" end end |