Class: OData::AbstractQuery::Segments::EntityTypeSegment
- Inherits:
-
OData::AbstractQuery::Segment
- Object
- OData::AbstractQuery::Segment
- OData::AbstractQuery::Segments::EntityTypeSegment
- Includes:
- Countable
- Defined in:
- lib/o_data/abstract_query/segments/entity_type_segment.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#entity_type ⇒ Object
readonly
Returns the value of attribute entity_type.
Attributes inherited from OData::AbstractQuery::Segment
Class Method Summary collapse
Instance Method Summary collapse
- #execute!(acc) ⇒ Object
-
#initialize(query, entity_type, value = nil) ⇒ EntityTypeSegment
constructor
A new instance of EntityTypeSegment.
- #valid?(results) ⇒ Boolean
Methods included from Countable
Methods inherited from OData::AbstractQuery::Segment
#can_follow?, #inspect, parse!, segment_name
Constructor Details
#initialize(query, entity_type, value = nil) ⇒ EntityTypeSegment
Returns a new instance of EntityTypeSegment.
9 10 11 12 13 |
# File 'lib/o_data/abstract_query/segments/entity_type_segment.rb', line 9 def initialize(query, entity_type, value = nil) @entity_type = entity_type super(query, value || (@entity_type.is_a?(OData::AbstractSchema::EntityType) ? @entity_type.plural_name : @entity_type)) end |
Instance Attribute Details
#entity_type ⇒ Object (readonly)
Returns the value of attribute entity_type.
7 8 9 |
# File 'lib/o_data/abstract_query/segments/entity_type_segment.rb', line 7 def entity_type @entity_type end |
Class Method Details
.can_follow?(anOtherSegment) ⇒ Boolean
15 16 17 |
# File 'lib/o_data/abstract_query/segments/entity_type_segment.rb', line 15 def self.can_follow?(anOtherSegment) false end |
Instance Method Details
#execute!(acc) ⇒ Object
19 20 21 22 23 |
# File 'lib/o_data/abstract_query/segments/entity_type_segment.rb', line 19 def execute!(acc) return [] if @entity_type.blank? @entity_type.find_all end |
#valid?(results) ⇒ Boolean
25 26 27 |
# File 'lib/o_data/abstract_query/segments/entity_type_segment.rb', line 25 def valid?(results) countable? ? results.is_a?(Array) : !results.blank? end |