Class: EJSONExt::Decoders::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/ejson_ext/decoders/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value, decoders, parent = NullNode.new) ⇒ Node

Returns a new instance of Node.



6
7
8
9
10
11
# File 'lib/ejson_ext/decoders/node.rb', line 6

def initialize(key, value, decoders, parent = NullNode.new)
  @key = key
  @value = value
  @decoders = decoders
  @parent = parent
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



4
5
6
# File 'lib/ejson_ext/decoders/node.rb', line 4

def key
  @key
end

#parentObject (readonly)

Returns the value of attribute parent.



4
5
6
# File 'lib/ejson_ext/decoders/node.rb', line 4

def parent
  @parent
end

Instance Method Details

#compile(hash) ⇒ Object



17
18
19
# File 'lib/ejson_ext/decoders/node.rb', line 17

def compile(hash)
  decoder.decoded_value(self, hash)
end

#valueObject



13
14
15
# File 'lib/ejson_ext/decoders/node.rb', line 13

def value
  @computed_value ||= computed_value
end