Class: Sunspot::NullResult::GroupedCollection
- Inherits:
-
Object
- Object
- Sunspot::NullResult::GroupedCollection
- Includes:
- Enumerable
- Defined in:
- lib/sunspot/null_result/grouped_collection.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#group_by ⇒ Object
readonly
Returns the value of attribute group_by.
Instance Method Summary collapse
- #each(*args, &block) ⇒ Object
-
#initialize(collection, group_by = nil) ⇒ GroupedCollection
constructor
A new instance of GroupedCollection.
- #to_a ⇒ Object
Constructor Details
#initialize(collection, group_by = nil) ⇒ GroupedCollection
Returns a new instance of GroupedCollection.
9 10 11 12 |
# File 'lib/sunspot/null_result/grouped_collection.rb', line 9 def initialize(collection, group_by = nil) @collection = group_by.nil? ? [] : Array(collection) @group_by = group_by || :itself end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
7 8 9 |
# File 'lib/sunspot/null_result/grouped_collection.rb', line 7 def collection @collection end |
#group_by ⇒ Object (readonly)
Returns the value of attribute group_by.
7 8 9 |
# File 'lib/sunspot/null_result/grouped_collection.rb', line 7 def group_by @group_by end |
Instance Method Details
#each(*args, &block) ⇒ Object
22 23 24 |
# File 'lib/sunspot/null_result/grouped_collection.rb', line 22 def each(*args, &block) to_a.each(*args, &block) end |