Class: MarshalParser::Parser::ObjectLinkNode

Inherits:
Node
  • Object
show all
Defined in:
lib/marshal-parser/parser.rb

Instance Method Summary collapse

Methods inherited from Node

#always_leaf?, #children, #tokens

Methods included from Assertable

#assert

Constructor Details

#initialize(prefix, index) ⇒ ObjectLinkNode

Returns a new instance of ObjectLinkNode.



794
795
796
797
798
799
800
801
# File 'lib/marshal-parser/parser.rb', line 794

def initialize(prefix, index)
  super()
  assert_token_type prefix, Lexer::OBJECT_LINK_PREFIX
  assert_token_type index, Lexer::INTEGER

  @prefix = prefix
  @index = index
end

Instance Method Details

#attributesObject



815
816
817
818
819
# File 'lib/marshal-parser/parser.rb', line 815

def attributes
  {
    @index => { name: :index, value: @index.value }
  }
end

#child_entitiesObject



803
804
805
# File 'lib/marshal-parser/parser.rb', line 803

def child_entities
  [@prefix, @index]
end

#decoded_valueObject



807
808
809
# File 'lib/marshal-parser/parser.rb', line 807

def decoded_value
  @index.value
end

#literal_tokenObject



811
812
813
# File 'lib/marshal-parser/parser.rb', line 811

def literal_token
  @index
end