Class: Radiosonde::DSL::Context

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

Defined Under Namespace

Classes: Alarm

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TemplateHelper

#context, #include_template

Methods included from Validator

#_call_once, #_expected_type, #_identify, #_required, #_validate

Constructor Details

#initialize(path, options = {}, &block) ⇒ Context

Returns a new instance of Context.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/radiosonde/dsl/context.rb', line 15

def initialize(path, options = {}, &block)
  @path = path
  @options = options
  @result = OpenStruct.new(:alarms => [])
  @alarm_names = []

  @context = Hashie::Mash.new(
    :path => path,
    :options => options,
    :templates => {}
  )

  instance_eval(&block)
end

Instance Attribute Details

#resultObject (readonly)

of class methods



13
14
15
# File 'lib/radiosonde/dsl/context.rb', line 13

def result
  @result
end

Class Method Details

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



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

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