Class: JSONP3::FilterExpressionLiteral

Inherits:
Expression
  • Object
show all
Defined in:
lib/json_p3/filter.rb

Overview

Base class for expression literals.

Instance Attribute Summary collapse

Attributes inherited from Expression

#token

Instance Method Summary collapse

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

#valueObject (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

#hashObject



110
111
112
# File 'lib/json_p3/filter.rb', line 110

def hash
  [@value, @token].hash
end

#to_sObject



98
99
100
# File 'lib/json_p3/filter.rb', line 98

def to_s
  @value.to_s
end