Class: JSONP3::FilterExpressionLiteral
- Inherits:
-
Expression
- Object
- Expression
- JSONP3::FilterExpressionLiteral
- Defined in:
- lib/json_p3/filter.rb
Overview
Base class for expression literals.
Direct Known Subclasses
BooleanLiteral, FloatLiteral, IntegerLiteral, NullLiteral, StringLiteral
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Expression
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #evaluate(_context) ⇒ Object
- #hash ⇒ Object
-
#initialize(token, value) ⇒ FilterExpressionLiteral
constructor
A new instance of FilterExpressionLiteral.
- #to_s ⇒ Object
Constructor Details
#initialize(token, value) ⇒ FilterExpressionLiteral
Returns a new instance of FilterExpressionLiteral.
89 90 91 92 |
# File 'lib/json_p3/filter.rb', line 89 def initialize(token, value) super(token) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
87 88 89 |
# File 'lib/json_p3/filter.rb', line 87 def value @value end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
102 103 104 105 106 |
# File 'lib/json_p3/filter.rb', line 102 def ==(other) self.class == other.class && @value == other.value && @token == other.token end |
#evaluate(_context) ⇒ Object
94 95 96 |
# File 'lib/json_p3/filter.rb', line 94 def evaluate(_context) @value end |
#hash ⇒ Object
110 111 112 |
# File 'lib/json_p3/filter.rb', line 110 def hash [@value, @token].hash end |
#to_s ⇒ Object
98 99 100 |
# File 'lib/json_p3/filter.rb', line 98 def to_s @value.to_s end |