Class: BasicPresenter::Generators::PresenterGenerator

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

Instance Method Summary collapse

Instance Method Details

#create_presenter_fileObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/basic_presenter/presenter_generator.rb', line 7

def create_presenter_file
  create_file "app/presenters/#{file_name}_presenter.rb", <<-FILE
  class #{class_name}Presenter < ApplicationPresenter
    presents :#{plural_name.singularize}

    # Methods delegated to Presented Class #{class_name} object's #{plural_name.singularize}
    @delegation_methods = []

    delegate *@delegation_methods, to: :#{plural_name.singularize}

    # Start the methods
    # def full_name
    #   first_name + last_name
    # end
  end
  FILE
end