Class: Roadworker::DSL
- Inherits:
-
Object
- Object
- Roadworker::DSL
- Includes:
- TemplateHelper
- Defined in:
- lib/roadworker/dsl.rb,
lib/roadworker/dsl-converter.rb,
lib/roadworker/dsl-tester.rb
Defined Under Namespace
Classes: Converter, Hostedzone, Tester
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
of class method.
Class Method Summary collapse
- .convert(hosted_zones) ⇒ Object
- .define(source, path, lineno = 1) ⇒ Object
- .test(dsl, options) ⇒ Object
Instance Method Summary collapse
-
#initialize(path, &block) ⇒ DSL
constructor
A new instance of DSL.
- #template(name, &block) ⇒ Object
Methods included from TemplateHelper
Constructor Details
#initialize(path, &block) ⇒ DSL
Returns a new instance of DSL.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/roadworker/dsl.rb', line 23 def initialize(path, &block) @path = path @result = OpenStruct.new({:hosted_zones => []}) @context = Hashie::Mash.new( :path => path, :templates => {} ) instance_eval(&block) end |
Instance Attribute Details
#result ⇒ Object (readonly)
of class method
21 22 23 |
# File 'lib/roadworker/dsl.rb', line 21 def result @result end |
Class Method Details
.convert(hosted_zones) ⇒ Object
12 13 14 |
# File 'lib/roadworker/dsl.rb', line 12 def convert(hosted_zones) Converter.convert(hosted_zones) end |
.define(source, path, lineno = 1) ⇒ Object
6 7 8 9 10 |
# File 'lib/roadworker/dsl.rb', line 6 def define(source, path, lineno = 1) self.new(path) do eval(source, binding, path, lineno) end end |
Instance Method Details
#template(name, &block) ⇒ Object
35 36 37 |
# File 'lib/roadworker/dsl.rb', line 35 def template(name, &block) @context.templates[name.to_s] = block end |