Class: JSONP3::Segment

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

Overview

Base class for all JSONPath segments.

Direct Known Subclasses

ChildSegment, RecursiveDescentSegment

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, token, selectors) ⇒ Segment

Returns a new instance of Segment.


9
10
11
12
13
# File 'lib/json_p3/segment.rb', line 9

def initialize(env, token, selectors)
  @env = env
  @token = token
  @selectors = selectors
end

Instance Attribute Details

#selectorsObject (readonly)

Returns the value of attribute selectors.


7
8
9
# File 'lib/json_p3/segment.rb', line 7

def selectors
  @selectors
end

#tokenObject (readonly)

Returns the value of attribute token.


7
8
9
# File 'lib/json_p3/segment.rb', line 7

def token
  @token
end

Instance Method Details

#resolve(_nodes) ⇒ Object

Select the children of each node in nodes.


16
17
18
# File 'lib/json_p3/segment.rb', line 16

def resolve(_nodes)
  raise "segments must implement resolve(nodes)"
end