Class: MarshalParser::Parser::ObjectWithDumpMethodNode

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

Instance Method Summary collapse

Methods inherited from Node

#always_leaf?, #children, #decoded_value, #tokens

Methods included from Assertable

#assert

Constructor Details

#initialize(token, class_name_node, length, user_dump) ⇒ ObjectWithDumpMethodNode

Returns a new instance of ObjectWithDumpMethodNode.



823
824
825
826
827
828
829
830
831
832
833
# File 'lib/marshal-parser/parser.rb', line 823

def initialize(token, class_name_node, length, user_dump)
  super()
  assert_token_type token, Lexer::OBJECT_WITH_DUMP_PREFIX
  assert_token_type length, Lexer::INTEGER
  assert_token_type user_dump, Lexer::STRING

  @prefix = token
  @class_name_node = class_name_node
  @length = length
  @user_dump = user_dump
end

Instance Method Details

#attributesObject



843
844
845
846
847
848
# File 'lib/marshal-parser/parser.rb', line 843

def attributes
  {
    @length => { name: :length, value: @length.value },
    @user_dump => { name: :dump, value: @user_dump }
  }
end

#child_entitiesObject



835
836
837
# File 'lib/marshal-parser/parser.rb', line 835

def child_entities
  [@prefix, @class_name_node, @length, @user_dump]
end

#literal_tokenObject



839
840
841
# File 'lib/marshal-parser/parser.rb', line 839

def literal_token
  @user_dump
end