Class: MarshalParser::Parser::BigIntegerNode

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, sign, length, value) ⇒ BigIntegerNode

Returns a new instance of BigIntegerNode.



501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/marshal-parser/parser.rb', line 501

def initialize(prefix, sign, length, value)
  super()
  assert_token_type prefix, Lexer::BIG_INTEGER_PREFIX
  assert_token_type sign, Lexer::PLUS_SIGN, Lexer::MINUS_SIGN
  assert_token_type length, Lexer::INTEGER
  assert_token_type value, Lexer::BIG_INTEGER

  @prefix = prefix
  @sign = sign
  @length = length
  @value = value
end

Instance Method Details

#attributesObject



526
527
528
529
530
# File 'lib/marshal-parser/parser.rb', line 526

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

#child_entitiesObject



514
515
516
# File 'lib/marshal-parser/parser.rb', line 514

def child_entities
  [@prefix, @sign, @length, @value]
end

#decoded_valueObject



518
519
520
# File 'lib/marshal-parser/parser.rb', line 518

def decoded_value
  @value.value
end

#literal_tokenObject



522
523
524
# File 'lib/marshal-parser/parser.rb', line 522

def literal_token
  @value
end