class OData::AbstractQuery::Segments::PropertySegment

Attributes

property[R]

Public Class Methods

can_follow?(anOtherSegment) click to toggle source
# File lib/o_data/abstract_query/segments/property_segment.rb, line 24
def self.can_follow?(anOtherSegment)
  if anOtherSegment.is_a?(Class)
    anOtherSegment == CollectionSegment || anOtherSegment == NavigationPropertySegment
  else
    (anOtherSegment.is_a?(CollectionSegment) || anOtherSegment.is_a?(NavigationPropertySegment)) && !anOtherSegment.countable?
  end
end
new(query, entity_type, property) click to toggle source
# File lib/o_data/abstract_query/segments/property_segment.rb, line 18
def initialize(query, entity_type, property)
  @property = property

  super(query, entity_type, @property.name)
end
parse!(query, str) click to toggle source
# File lib/o_data/abstract_query/segments/property_segment.rb, line 7
def self.parse!(query, str)
  return nil if query.segments.empty?
  return nil unless query.segments.last.respond_to?(:entity_type)
  entity_type = query.segments.last.entity_type
  return nil if entity_type.nil?
  property = entity_type.properties.find { |p| p.name == str }
  return nil if property.blank?

  query.Segment(self, entity_type, property)
end

Public Instance Methods

countable?() click to toggle source
# File lib/o_data/abstract_query/segments/property_segment.rb, line 32
def countable?
  false
end
execute!(acc) click to toggle source
# File lib/o_data/abstract_query/segments/property_segment.rb, line 36
def execute!(acc)
  # [acc].flatten.compact.collect { |one|
  #   [one, @property.value_for(one)]
  # }
  { @property => @property.value_for([acc].flatten.compact.first) }
end
valid?(results) click to toggle source
# File lib/o_data/abstract_query/segments/property_segment.rb, line 43
def valid?(results)
  # results.is_a?(Array)
  !results.blank?
end