Sha256: 2eab71a0ee28e54e2ca17dbf3c8da3492c8c8d83e42dac85c513c6a7e55cbf2a

Contents?: true

Size: 482 Bytes

Versions: 2

Compression:

Stored size: 482 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 TemplateException, '#{@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.8.0 lib/buildmaster/templatelets/attribute.rb
BuildMaster-0.8.1 lib/buildmaster/templatelets/attribute.rb