Class: JSONP3::Expression

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

Overview

Base class for all filter expression nodes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Expression

Returns a new instance of Expression.



12
13
14
# File 'lib/json_p3/filter.rb', line 12

def initialize(token)
  @token = token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



10
11
12
# File 'lib/json_p3/filter.rb', line 10

def token
  @token
end

Instance Method Details

#evaluate(_context) ⇒ Object

Evaluate the filter expression in the given context.



17
18
19
# File 'lib/json_p3/filter.rb', line 17

def evaluate(_context)
  raise "filter expressions must implement `evaluate(context)`"
end