Class: Monosasi::DSL::Context
- Inherits:
-
Object
- Object
- Monosasi::DSL::Context
show all
- Includes:
- TemplateHelper
- Defined in:
- lib/monosasi/dsl/context.rb
Defined Under Namespace
Classes: Rule
Class Method Summary
collapse
Instance Method Summary
collapse
#context, #include_template
Constructor Details
#initialize(path, options = {}, &block) ⇒ Context
Returns a new instance of Context.
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/monosasi/dsl/context.rb', line 14
def initialize(path, options = {}, &block)
@path = path
@options = options
@result = {}
@context = Hashie::Mash.new(
:path => path,
:options => options,
:templates => {}
)
instance_eval(&block)
end
|
Class Method Details
.eval(dsl, path, options = {}) ⇒ Object
4
5
6
7
8
|
# File 'lib/monosasi/dsl/context.rb', line 4
def self.eval(dsl, path, options = {})
self.new(path, options) do
eval(dsl, binding, path)
end
end
|
Instance Method Details
#result ⇒ Object
10
11
12
|
# File 'lib/monosasi/dsl/context.rb', line 10
def result
@result.sort_array!
end
|
#template(name, &block) ⇒ Object
28
29
30
|
# File 'lib/monosasi/dsl/context.rb', line 28
def template(name, &block)
@context.templates[name.to_s] = block
end
|