Class: Sunspot::NullResult
- Inherits:
-
Object
- Object
- Sunspot::NullResult
- Defined in:
- lib/sunspot/null_result.rb,
lib/sunspot/null_result/hit.rb,
lib/sunspot/null_result/group.rb,
lib/sunspot/null_result/version.rb,
lib/sunspot/null_result/grouped_collection.rb
Defined Under Namespace
Classes: Group, GroupedCollection, Hit, PaginatedNullArray
Constant Summary collapse
- VERSION =
"0.3.0"
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#group_by ⇒ Object
readonly
Returns the value of attribute group_by.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #group(group) ⇒ Object
- #groups ⇒ Object
- #hits ⇒ Object
-
#initialize(*collection, **options) ⇒ NullResult
constructor
A new instance of NullResult.
- #results ⇒ Object
Constructor Details
#initialize(*collection, **options) ⇒ NullResult
Returns a new instance of NullResult.
10 11 12 13 14 |
# File 'lib/sunspot/null_result.rb', line 10 def initialize(*collection, **) @collection = collection.flatten @options = @group_by = nil end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
8 9 10 |
# File 'lib/sunspot/null_result.rb', line 8 def collection @collection end |
#group_by ⇒ Object (readonly)
Returns the value of attribute group_by.
8 9 10 |
# File 'lib/sunspot/null_result.rb', line 8 def group_by @group_by end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/sunspot/null_result.rb', line 8 def @options end |
Instance Method Details
#group(group) ⇒ Object
69 70 71 72 |
# File 'lib/sunspot/null_result.rb', line 69 def group(group) @group_by = group self end |
#groups ⇒ Object
74 75 76 |
# File 'lib/sunspot/null_result.rb', line 74 def groups GroupedCollection.new(collection, group_by).to_a end |
#hits ⇒ Object
61 62 63 |
# File 'lib/sunspot/null_result.rb', line 61 def hits PaginatedNullArray.new(collection, ) end |
#results ⇒ Object
65 66 67 |
# File 'lib/sunspot/null_result.rb', line 65 def results PaginatedNullArray.new(collection, ) end |