Class: Uncouple::Generators::Action

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/uncouple/rails/generators/action_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

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_generatorObject



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