Class: OData::AbstractQuery::Segments::ValueSegment

Inherits:
OData::AbstractQuery::Segment show all
Defined in:
lib/o_data/abstract_query/segments/value_segment.rb

Instance Attribute Summary

Attributes inherited from OData::AbstractQuery::Segment

#query, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OData::AbstractQuery::Segment

#can_follow?, #inspect

Constructor Details

#initialize(query) ⇒ ValueSegment

Returns a new instance of ValueSegment.



15
16
17
# File 'lib/o_data/abstract_query/segments/value_segment.rb', line 15

def initialize(query)
  super(query, self.class.segment_name)
end

Class Method Details

.can_follow?(anOtherSegment) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
# File 'lib/o_data/abstract_query/segments/value_segment.rb', line 19

def self.can_follow?(anOtherSegment)
  if anOtherSegment.is_a?(Class)
    anOtherSegment == PropertySegment
  else
    anOtherSegment.is_a?(PropertySegment)
  end
end

.parse!(query, str) ⇒ Object



5
6
7
8
9
# File 'lib/o_data/abstract_query/segments/value_segment.rb', line 5

def self.parse!(query, str)
  return nil unless str.to_s == segment_name

  query.Segment(self)
end

.segment_nameObject



11
12
13
# File 'lib/o_data/abstract_query/segments/value_segment.rb', line 11

def self.segment_name
  "$value"
end

Instance Method Details

#execute!(acc) ⇒ Object



27
28
29
30
# File 'lib/o_data/abstract_query/segments/value_segment.rb', line 27

def execute!(acc)
  # acc
  acc.values.first
end

#valid?(results) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
36
# File 'lib/o_data/abstract_query/segments/value_segment.rb', line 32

def valid?(results)
  # # results.is_a?(Array)
  # !results.blank?
  true
end