Class: ApiPresenter::Generators::PresenterGenerator

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

Instance Method Summary collapse

Instance Method Details

#create_application_presenterObject



6
7
8
9
10
# File 'lib/generators/api_presenter/presenter/presenter_generator.rb', line 6

def create_application_presenter
  unless File.exist?('app/presenters/application_api_presenter.rb')
    copy_file('application_presenter.rb', 'app/presenters/application_api_presenter.rb')
  end
end

#create_presenterObject



12
13
14
# File 'lib/generators/api_presenter/presenter/presenter_generator.rb', line 12

def create_presenter
  template('presenter.rb', File.join('app/presenters', class_path, "#{file_name}_presenter.rb"))
end