Class: RubyJsonParser::AST::InvalidNode

Inherits:
Node
  • Object
show all
Defined in:
lib/ruby_json_parser/ast.rb

Overview

Represents an invalid node

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ InvalidNode

Returns a new instance of InvalidNode.



34
35
36
# File 'lib/ruby_json_parser/ast.rb', line 34

def initialize(token)
  @token = token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



31
32
33
# File 'lib/ruby_json_parser/ast.rb', line 31

def token
  @token
end

Instance Method Details

#==(other) ⇒ Object



39
40
41
42
43
# File 'lib/ruby_json_parser/ast.rb', line 39

def ==(other)
  return false unless other.is_a?(InvalidNode)

  token == other.token
end

#inspect(indent = 0) ⇒ Object



51
52
53
# File 'lib/ruby_json_parser/ast.rb', line 51

def inspect(indent = 0)
  "#{INDENT_UNIT * indent}(invalid `#{token}`)"
end

#to_sObject



46
47
48
# File 'lib/ruby_json_parser/ast.rb', line 46

def to_s
  "<invalid: `#{token}`>"
end