Class: SteelWheel::HandlerGenerator

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

Instance Method Summary collapse

Instance Method Details

#copy_filesObject



7
8
9
10
11
12
13
14
# File 'lib/generators/steel_wheel/handler/handler_generator.rb', line 7

def copy_files
  if behavior == :revoke
    template 'handler_template.rb', "app/handlers/#{file_path}_handler.rb"
  elsif behavior == :invoke
    empty_directory Pathname.new('app/handlers').join(*class_path)
    template 'handler_template.rb', "app/handlers/#{file_path}_handler.rb"
  end
end