class Dry::Web::WebPipe::Generators::AbstractGenerator

Attributes

options[R]
target_dir[R]
templates[R]

Public Class Methods

new(target_dir, options = {}) click to toggle source
# File lib/dry/web/web_pipe/generators/abstract_generator.rb, line 11
def initialize(target_dir, options = {})
  @target_dir = target_dir
  @options = options
  @templates = []
  populate_templates
  @templates.freeze
end

Public Instance Methods

call() click to toggle source
# File lib/dry/web/web_pipe/generators/abstract_generator.rb, line 19
def call
  templates.each do |source, target|
    generator.(source, target)
  end
  post_process_callback
end

Private Instance Methods

add_template(source, target) click to toggle source
# File lib/dry/web/web_pipe/generators/abstract_generator.rb, line 29
def add_template(source, target)
  templates << [source, target]
end
destination() click to toggle source
# File lib/dry/web/web_pipe/generators/abstract_generator.rb, line 47
def destination
  fail NotImplementedError
end
generator() click to toggle source
# File lib/dry/web/web_pipe/generators/abstract_generator.rb, line 33
def generator
  @generator ||= Generate.new(destination, template_scope)
end
post_process_callback() click to toggle source
# File lib/dry/web/web_pipe/generators/abstract_generator.rb, line 37
def post_process_callback; end
template_scope() click to toggle source
# File lib/dry/web/web_pipe/generators/abstract_generator.rb, line 43
def template_scope
  fail NotImplementedError
end
underscored_project_name() click to toggle source
# File lib/dry/web/web_pipe/generators/abstract_generator.rb, line 39
def underscored_project_name
  @underscored_project_name ||= Inflections.underscored_name(target_dir)
end