Class: JSONP3::Segment
- Inherits:
-
Object
- Object
- JSONP3::Segment
- Defined in:
- lib/json_p3/segment.rb
Overview
Base class for all JSONPath segments.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#selectors ⇒ Object
readonly
Returns the value of attribute selectors.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(env, token, selectors) ⇒ Segment
constructor
A new instance of Segment.
-
#resolve(_nodes) ⇒ Array<JSONPathNode>
Select the children of each node in nodes.
-
#resolve_enum(_nodes) ⇒ Enumerable<JSONPathNode>
Select the children of each node in nodes.
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
#selectors ⇒ Object (readonly)
Returns the value of attribute selectors.
7 8 9 |
# File 'lib/json_p3/segment.rb', line 7 def selectors @selectors end |
#token ⇒ Object (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) ⇒ Array<JSONPathNode>
Select the children of each node in nodes.
17 18 19 |
# File 'lib/json_p3/segment.rb', line 17 def resolve(_nodes) raise "segments must implement resolve(nodes)" end |
#resolve_enum(_nodes) ⇒ Enumerable<JSONPathNode>
Select the children of each node in nodes.
23 24 25 |
# File 'lib/json_p3/segment.rb', line 23 def resolve_enum(_nodes) raise "segments must implement resolve_enum(nodes)" end |