Class: Gratan::DSL::Context

Inherits:
Object
  • Object
show all
Includes:
Validator, Logger::Helper, TemplateHelper
Defined in:
lib/gratan/dsl/context.rb

Defined Under Namespace

Classes: On, User

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TemplateHelper

#context, #include_template

Methods included from Logger::Helper

#log

Methods included from Validator

#__identify, #__validate

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/gratan/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

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



12
13
14
# File 'lib/gratan/dsl/context.rb', line 12

def result
  @result
end

Class Method Details

.eval(dsl, path, options = {}) ⇒ Object



6
7
8
9
10
# File 'lib/gratan/dsl/context.rb', line 6

def self.eval(dsl, path, options = {})
  self.new(path, options) do
    eval(dsl, binding, path)
  end
end