Class: SyntaxTree::JSON::Parser::Token
- Inherits:
-
Object
- Object
- SyntaxTree::JSON::Parser::Token
- Defined in:
- lib/syntax_tree/json/parser.rb
Overview
This represents a parsed token from the source.
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(type:, value: nil) ⇒ Token
constructor
A new instance of Token.
Constructor Details
#initialize(type:, value: nil) ⇒ Token
Returns a new instance of Token.
31 32 33 34 |
# File 'lib/syntax_tree/json/parser.rb', line 31 def initialize(type:, value: nil) @type = type @value = value end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
29 30 31 |
# File 'lib/syntax_tree/json/parser.rb', line 29 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
29 30 31 |
# File 'lib/syntax_tree/json/parser.rb', line 29 def value @value end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
36 37 38 |
# File 'lib/syntax_tree/json/parser.rb', line 36 def deconstruct_keys(keys) { type: type, value: value } end |