Class: MarshalParser::Parser::ModuleNode

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(prefix, length, name) ⇒ ModuleNode

Returns a new instance of ModuleNode.



705
706
707
708
709
710
711
712
713
714
# File 'lib/marshal-parser/parser.rb', line 705

def initialize(prefix, length, name)
  super()
  assert_token_type prefix, Lexer::MODULE_PREFIX
  assert_token_type length, Lexer::INTEGER
  assert_token_type name, Lexer::STRING

  @prefix = prefix
  @length = length
  @name = name
end

Instance Method Details

#attributesObject



724
725
726
727
728
729
# File 'lib/marshal-parser/parser.rb', line 724

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

#child_entitiesObject



716
717
718
# File 'lib/marshal-parser/parser.rb', line 716

def child_entities
  [@prefix, @length, @name]
end

#literal_tokenObject



720
721
722
# File 'lib/marshal-parser/parser.rb', line 720

def literal_token
  @name
end