Class: MarshalParser::Parser::StructNode

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, members_count, member_nodes) ⇒ StructNode

Returns a new instance of StructNode.



748
749
750
751
752
753
754
755
756
757
# File 'lib/marshal-parser/parser.rb', line 748

def initialize(prefix, class_name_node, members_count, member_nodes)
  super()
  assert_token_type prefix, Lexer::STRUCT_PREFIX
  assert_token_type members_count, Lexer::INTEGER

  @prefix = prefix
  @class_name_node = class_name_node
  @members_count = members_count
  @member_nodes = member_nodes
end

Instance Method Details

#attributesObject



763
764
765
766
767
# File 'lib/marshal-parser/parser.rb', line 763

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

#child_entitiesObject



759
760
761
# File 'lib/marshal-parser/parser.rb', line 759

def child_entities
  [@prefix, @class_name_node, @members_count] + @member_nodes
end