Class: JSONP3::Path::Expression

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



14
15
16
# File 'lib/json_p3/path/filter.rb', line 14

def initialize(token)
  @token = token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



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

def token
  @token
end

Instance Method Details

#evaluate(_context) ⇒ Object

Evaluate the filter expression in the given context.



19
20
21
# File 'lib/json_p3/path/filter.rb', line 19

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