Class: Parametric::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/parametric/context.rb

Instance Method Summary collapse

Constructor Details

#initialize(path = nil, top = Top.new) ⇒ Context

Returns a new instance of Context.



16
17
18
19
# File 'lib/parametric/context.rb', line 16

def initialize(path = nil, top = Top.new)
  @top = top
  @path = Array(path).compact
end

Instance Method Details

#add_error(msg) ⇒ Object



25
26
27
# File 'lib/parametric/context.rb', line 25

def add_error(msg)
  top.add_error(string_path, msg)
end

#errorsObject



21
22
23
# File 'lib/parametric/context.rb', line 21

def errors
  top.errors
end

#sub(key) ⇒ Object



29
30
31
# File 'lib/parametric/context.rb', line 29

def sub(key)
  self.class.new(path + [key], top)
end