Class: Dry::Web::Roda::Generators::AbstractGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/web/roda/generators/abstract_generator.rb

Direct Known Subclasses

AbstractProject, SubApp

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target_dir, options = {}) ⇒ AbstractGenerator

Returns a new instance of AbstractGenerator.



11
12
13
14
15
16
17
# File 'lib/dry/web/roda/generators/abstract_generator.rb', line 11

def initialize(target_dir, options = {})
  @target_dir = target_dir
  @options = options
  @templates = []
  populate_templates
  @templates.freeze
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/dry/web/roda/generators/abstract_generator.rb', line 9

def options
  @options
end

#target_dirObject (readonly)

Returns the value of attribute target_dir.



9
10
11
# File 'lib/dry/web/roda/generators/abstract_generator.rb', line 9

def target_dir
  @target_dir
end

Instance Method Details

#callObject



19
20
21
22
23
24
# File 'lib/dry/web/roda/generators/abstract_generator.rb', line 19

def call
  templates.each do |source, target|
    generator.(source, target)
  end
  post_process_callback
end