Class: MarshalParser::Parser::FloatNode

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

Returns a new instance of FloatNode.



534
535
536
537
538
539
540
541
542
543
# File 'lib/marshal-parser/parser.rb', line 534

def initialize(prefix, length, value)
  super()
  assert_token_type prefix, Lexer::FLOAT_PREFIX
  assert_token_type length, Lexer::INTEGER
  assert_token_type value, Lexer::FLOAT

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

Instance Method Details

#attributesObject



557
558
559
560
561
562
# File 'lib/marshal-parser/parser.rb', line 557

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

#child_entitiesObject



545
546
547
# File 'lib/marshal-parser/parser.rb', line 545

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

#decoded_valueObject



549
550
551
# File 'lib/marshal-parser/parser.rb', line 549

def decoded_value
  @value.value
end

#literal_tokenObject



553
554
555
# File 'lib/marshal-parser/parser.rb', line 553

def literal_token
  @value
end