2013-07-28 18:38:00 +00:00

38 lines
594 B
Ruby

module Producer
module Core
class Recipe
attr_reader :code
def self.from_file(filepath)
new(File.read(filepath))
end
def initialize(code)
@code = code
end
def evaluate
dsl = DSL.new(@code)
end
class DSL
def initialize(code = nil, &block)
if code
instance_eval code
else
instance_eval &block
end
end
private
def source(filepath)
instance_eval File.read("./#{filepath}.rb")
end
end
end
end
end