Class: JSONP3::Path::FilterExpressionLiteral

Inherits:
Expression
  • Object
show all
Defined in:
lib/json_p3/path/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.



91
92
93
94
# File 'lib/json_p3/path/filter.rb', line 91

def initialize(token, value)
  super(token)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



89
90
91
# File 'lib/json_p3/path/filter.rb', line 89

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



104
105
106
107
108
# File 'lib/json_p3/path/filter.rb', line 104

def ==(other)
  self.class == other.class &&
    @value == other.value &&
    @token == other.token
end

#evaluate(_context) ⇒ Object



96
97
98
# File 'lib/json_p3/path/filter.rb', line 96

def evaluate(_context)
  @value
end

#hashObject



112
113
114
# File 'lib/json_p3/path/filter.rb', line 112

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

#to_sObject



100
101
102
# File 'lib/json_p3/path/filter.rb', line 100

def to_s
  @value.to_s
end