Class: MarshalParser::Parser::ObjectNode

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, #literal_token, #tokens

Methods included from Assertable

#assert

Constructor Details

#initialize(prefix, class_name_node, ivars_count, ivars_nodes) ⇒ ObjectNode

Returns a new instance of ObjectNode.



771
772
773
774
775
776
777
778
779
780
# File 'lib/marshal-parser/parser.rb', line 771

def initialize(prefix, class_name_node, ivars_count, ivars_nodes)
  super()
  assert_token_type prefix, Lexer::OBJECT_PREFIX
  assert_token_type ivars_count, Lexer::INTEGER

  @prefix = prefix
  @class_name_node = class_name_node
  @ivars_count = ivars_count
  @ivars_nodes = ivars_nodes
end

Instance Method Details

#attributesObject



786
787
788
789
790
# File 'lib/marshal-parser/parser.rb', line 786

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

#child_entitiesObject



782
783
784
# File 'lib/marshal-parser/parser.rb', line 782

def child_entities
  [@prefix, @class_name_node, @ivars_count] + @ivars_nodes
end