Class: RubyJsonParser::AST::NumberLiteralNode
- Defined in:
- lib/ruby_json_parser/ast.rb
Overview
Represents a number literal eg. ‘123.5`
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(value) ⇒ NumberLiteralNode
constructor
A new instance of NumberLiteralNode.
- #inspect(indent = 0) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ NumberLiteralNode
Returns a new instance of NumberLiteralNode.
116 117 118 |
# File 'lib/ruby_json_parser/ast.rb', line 116 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
113 114 115 |
# File 'lib/ruby_json_parser/ast.rb', line 113 def value @value end |
Instance Method Details
#==(other) ⇒ Object
121 122 123 124 125 |
# File 'lib/ruby_json_parser/ast.rb', line 121 def ==(other) return false unless other.is_a?(NumberLiteralNode) value == other.value end |
#inspect(indent = 0) ⇒ Object
133 134 135 |
# File 'lib/ruby_json_parser/ast.rb', line 133 def inspect(indent = 0) "#{INDENT_UNIT * indent}#{value}" end |
#to_s ⇒ Object
128 129 130 |
# File 'lib/ruby_json_parser/ast.rb', line 128 def to_s value end |