Class: MarshalParser::Parser::IntegerNode

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, value) ⇒ IntegerNode

Returns a new instance of IntegerNode.



472
473
474
475
476
477
478
479
# File 'lib/marshal-parser/parser.rb', line 472

def initialize(prefix, value)
  super()
  assert_token_type prefix, Lexer::INTEGER_PREFIX
  assert_token_type value, Lexer::INTEGER

  @prefix = prefix
  @value = value
end

Instance Method Details

#attributesObject



493
494
495
496
497
# File 'lib/marshal-parser/parser.rb', line 493

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

#child_entitiesObject



481
482
483
# File 'lib/marshal-parser/parser.rb', line 481

def child_entities
  [@prefix, @value]
end

#decoded_valueObject



485
486
487
# File 'lib/marshal-parser/parser.rb', line 485

def decoded_value
  @value.value
end

#literal_tokenObject



489
490
491
# File 'lib/marshal-parser/parser.rb', line 489

def literal_token
  @value
end