Introduce Recipe::DSL to eval recipe DSL code
This commit is contained in:
1 parent
e5d5fc0a41
commit
8e4f670fbf
2 files changed
+28
-6
No files matched your search
@@ -12,7 +12,18 @@ module Producer
|
||||
end
|
||||
|
||||
def evaluate
|
||||
Object.new.instance_eval @code
|
||||
dsl = DSL.new(@code)
|
||||
end
|
||||
|
||||
|
||||
class DSL
|
||||
def initialize(code = nil, &block)
|
||||
if code
|
||||
instance_eval code
|
||||
else
|
||||
instance_eval &block
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user