Sha256: e7b9c7e9868ba80a3122b8f2b99474e2267f2850b40a06d3796bf42e8c07996f

Contents?: true

Size: 505 Bytes

Versions: 3

Compression:

Stored size: 505 Bytes

Contents

class PresenterGenerator < Rails::Generators::NamedBase
  source_root File.expand_path('../templates', __FILE__)

  def write_presenter
    template 'presenter.rb', "app/presenters/#{file_name_root}_presenter.rb"
  end

  def write_presenter_spec
    template 'presenter_spec.rb', "spec/presenters/#{file_name_root}_presenter_spec.rb"
  end

  protected

  def file_name_root
    name.underscore
  end

  def class_name
    name.camelize
  end

  def single_name
    name.underscore.singularize
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prospecto-0.1.3 lib/generators/presenter/presenter_generator.rb
prospecto-0.1.1 lib/generators/presenter/presenter_generator.rb
prospecto-0.0.9 lib/generators/presenter/presenter_generator.rb