Class: BuildMaster::When
- Inherits:
-
Object
- Object
- BuildMaster::When
- Defined in:
- lib/buildmaster/site/templatelets/when.rb
Instance Method Summary collapse
-
#initialize(site_spec, expression_evaluator) ⇒ When
constructor
A new instance of When.
- #process(target, template, source) ⇒ Object
Constructor Details
#initialize(site_spec, expression_evaluator) ⇒ When
Returns a new instance of When.
3 4 5 6 |
# File 'lib/buildmaster/site/templatelets/when.rb', line 3 def initialize(site_spec, expression_evaluator) @site_spec = site_spec @evaluator = expression_evaluator end |
Instance Method Details
#process(target, template, source) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/buildmaster/site/templatelets/when.rb', line 8 def process(target, template, source) eval = template.attribute_value!('test') raise TemplateError.new(template), "#{@evaluator.class} cannot evaluate expression #{eval}" unless @evaluator.respond_to?(eval) if (@evaluator.send(eval, source)) runner = TemplateRunner.new(target, @site_spec.load_element_processor, source) runner.process template end end |