Class: MundaneSearch::Result
- Inherits:
-
Object
- Object
- MundaneSearch::Result
- Includes:
- Enumerable, Buildable
- Defined in:
- lib/mundane-search/result.rb
Instance Attribute Summary collapse
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
Class Method Summary collapse
Instance Method Summary collapse
- #each(*args, &block) ⇒ Object
-
#initialize(collection, params) ⇒ Result
constructor
A new instance of Result.
- #to_a ⇒ Object
- #to_model ⇒ Object
Constructor Details
#initialize(collection, params) ⇒ Result
Returns a new instance of Result.
11 12 13 |
# File 'lib/mundane-search/result.rb', line 11 def initialize(collection, params) @stack = self.class.builder.result_for(collection,params) end |
Instance Attribute Details
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
10 11 12 |
# File 'lib/mundane-search/result.rb', line 10 def stack @stack end |
Class Method Details
.options ⇒ Object
6 7 8 |
# File 'lib/mundane-search/result.rb', line 6 def self. ||= {} end |
.result_model_class ⇒ Object
19 20 21 |
# File 'lib/mundane-search/result.rb', line 19 def self.result_model_class @result_model_class ||= ResultModel.model_class_for(self) end |
Instance Method Details
#each(*args, &block) ⇒ Object
27 28 29 30 |
# File 'lib/mundane-search/result.rb', line 27 def each(*args, &block) return enum_for(__callee__) unless block_given? to_a.each(*args, &block) end |
#to_a ⇒ Object
23 24 25 |
# File 'lib/mundane-search/result.rb', line 23 def to_a stack.collection end |
#to_model ⇒ Object
15 16 17 |
# File 'lib/mundane-search/result.rb', line 15 def to_model @result_model ||= self.class.result_model_class.new(self) end |