Class: OData::AbstractQuery::Segments::CollectionSegment

Inherits:
EntityTypeAndKeyValuesSegment show all
Defined in:
lib/o_data/abstract_query/segments/collection_segment.rb

Instance Attribute Summary

Attributes inherited from EntityTypeAndKeyValuesSegment

#key_values

Attributes inherited from EntityTypeSegment

#entity_type

Attributes inherited from OData::AbstractQuery::Segment

#query, #value

Class Method Summary collapse

Methods inherited from EntityTypeAndKeyValuesSegment

#countable?, #execute!, extract_schema_object_name_and_key_values_and_keys, #initialize, key?, #key?, #key_property_value, key_property_value_for, remove_quotes, sanitize_key_values_and_keys_for!, #value

Methods inherited from EntityTypeSegment

#execute!, #initialize, #valid?

Methods included from Countable

included

Methods inherited from OData::AbstractQuery::Segment

#can_follow?, #execute!, #initialize, #inspect, segment_name, #valid?

Constructor Details

This class inherits a constructor from OData::AbstractQuery::Segments::EntityTypeAndKeyValuesSegment

Class Method Details

.can_follow?(anOtherSegment) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/o_data/abstract_query/segments/collection_segment.rb', line 18

def self.can_follow?(anOtherSegment)
  anOtherSegment.blank?
end

.parse!(query, str) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/o_data/abstract_query/segments/collection_segment.rb', line 5

def self.parse!(query, str)
  return nil unless query.segments.empty?
  schema_object_name, key_values, keys = extract_schema_object_name_and_key_values_and_keys(str)
  return nil if schema_object_name.blank?

  entity_type = query.schema.find_entity_type(:name => schema_object_name.singularize)
  return nil if entity_type.blank?

  sanitized_key_values = sanitize_key_values_and_keys_for!(query, entity_type, key_values, keys)

  query.Segment(self, entity_type, sanitized_key_values)
end