Sha256: 22acc7499a4b2632bea12f6ca5162503358ae074e1a7dbbba9dbbd717baf2019

Contents?: true

Size: 478 Bytes

Versions: 2

Compression:

Stored size: 478 Bytes

Contents

module BuildMaster
class Attribute
  def initialize(expression_evaluator)
    @evaluator = expression_evaluator
  end
  
  def process(target, template, source)
    name = template.attribute_value!('name')
    eval = template.attribute_value!('eval')
    if (not @evaluator.respond_to?(eval))
      raise TemplateError, '#{@evaluator.class} cannot evaluate expression #{eval}'
    end
    target.attributes[name] = @evaluator.send(eval, source.path)
  end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
BuildMaster-0.9.0 lib/buildmaster/templatelets/attribute.rb
BuildMaster-0.9.1 lib/buildmaster/templatelets/attribute.rb