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