Class: OData::AbstractQuery::Segment
- Inherits:
-
Object
- Object
- OData::AbstractQuery::Segment
show all
- Defined in:
- lib/o_data/abstract_query/segment.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(query, value) ⇒ Segment
Returns a new instance of Segment.
14
15
16
17
18
19
|
# File 'lib/o_data/abstract_query/segment.rb', line 14
def initialize(query, value)
@query = query
@value = value
raise Errors::InvalidSegmentContext.new(@query, self) unless can_follow?(@query.segments.last)
end
|
Instance Attribute Details
#query ⇒ Object
Returns the value of attribute query.
4
5
6
|
# File 'lib/o_data/abstract_query/segment.rb', line 4
def query
@query
end
|
#value ⇒ Object
Returns the value of attribute value.
4
5
6
|
# File 'lib/o_data/abstract_query/segment.rb', line 4
def value
@value
end
|
Class Method Details
.can_follow?(anOtherSegment) ⇒ Boolean
21
22
23
24
|
# File 'lib/o_data/abstract_query/segment.rb', line 21
def self.can_follow?(anOtherSegment)
false
end
|
.parse!(query, str) ⇒ Object
6
7
8
|
# File 'lib/o_data/abstract_query/segment.rb', line 6
def self.parse!(query, str)
nil
end
|
.segment_name ⇒ Object
10
11
12
|
# File 'lib/o_data/abstract_query/segment.rb', line 10
def self.segment_name
name.to_s.demodulize.sub(/Segment$/, '')
end
|
Instance Method Details
#can_follow?(anOtherSegment) ⇒ Boolean
26
27
28
|
# File 'lib/o_data/abstract_query/segment.rb', line 26
def can_follow?(anOtherSegment)
self.class.can_follow?(anOtherSegment)
end
|
#execute!(acc) ⇒ Object
30
31
32
|
# File 'lib/o_data/abstract_query/segment.rb', line 30
def execute!(acc)
acc
end
|
#inspect ⇒ Object
34
35
36
|
# File 'lib/o_data/abstract_query/segment.rb', line 34
def inspect
"#<< #{@query.schema.namespace.to_s}(#{self.class.segment_name}: #{self.value.inspect}) >>"
end
|
#valid?(results) ⇒ Boolean
38
39
40
|
# File 'lib/o_data/abstract_query/segment.rb', line 38
def valid?(results)
!results.blank?
end
|