Class: NxtSchema::Node::DefaultValueEvaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/nxt_schema/node/default_value_evaluator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node, evaluator_or_value) ⇒ DefaultValueEvaluator

Returns a new instance of DefaultValueEvaluator.



4
5
6
7
# File 'lib/nxt_schema/node/default_value_evaluator.rb', line 4

def initialize(node, evaluator_or_value)
  @node = node
  @evaluator_or_value = evaluator_or_value
end

Instance Attribute Details

#evaluator_or_valueObject (readonly)

Returns the value of attribute evaluator_or_value.



9
10
11
# File 'lib/nxt_schema/node/default_value_evaluator.rb', line 9

def evaluator_or_value
  @evaluator_or_value
end

#nodeObject (readonly)

Returns the value of attribute node.



9
10
11
# File 'lib/nxt_schema/node/default_value_evaluator.rb', line 9

def node
  @node
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
# File 'lib/nxt_schema/node/default_value_evaluator.rb', line 11

def call
  if evaluator_or_value.respond_to?(:call)
    Callable.new(evaluator_or_value).call(node)
  else
    evaluator_or_value
  end
end