Class: Lotus::Generators::Generator
- Inherits:
-
Object
- Object
- Lotus::Generators::Generator
- Extended by:
- Forwardable
- Defined in:
- lib/lotus/generators/generator.rb
Overview
Defined Under Namespace
Classes: Processor
Instance Method Summary collapse
- #add_mapping(source, target) ⇒ Object
-
#initialize(template_source_path, target_path) ⇒ Generator
constructor
A new instance of Generator.
- #process_templates(options = {}) ⇒ Object
Constructor Details
#initialize(template_source_path, target_path) ⇒ Generator
Returns a new instance of Generator.
16 17 18 19 20 21 22 |
# File 'lib/lotus/generators/generator.rb', line 16 def initialize(template_source_path, target_path) @template_source_path = template_source_path @target_path = target_path @template_mappings = [] @processor = Processor.new @processor.class.source_root(@template_source_path) end |
Instance Method Details
#add_mapping(source, target) ⇒ Object
24 25 26 |
# File 'lib/lotus/generators/generator.rb', line 24 def add_mapping(source, target) @template_mappings << [source, target] end |
#process_templates(options = {}) ⇒ Object
28 29 30 31 32 |
# File 'lib/lotus/generators/generator.rb', line 28 def process_templates( = {}) @template_mappings.each do |src, dst| @processor.template(@template_source_path.join(src), @target_path.join(dst), ) end end |