Class: MultiModelPaginator::QueryStruct
- Inherits:
-
Object
- Object
- MultiModelPaginator::QueryStruct
- Defined in:
- lib/multi_model_paginator.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize(query, select, count) ⇒ QueryStruct
constructor
A new instance of QueryStruct.
- #with_select ⇒ Object
Constructor Details
#initialize(query, select, count) ⇒ QueryStruct
Returns a new instance of QueryStruct.
7 8 9 10 11 |
# File 'lib/multi_model_paginator.rb', line 7 def initialize(query, select, count) @query = query @select = select @count = count end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
5 6 7 |
# File 'lib/multi_model_paginator.rb', line 5 def query @query end |
Instance Method Details
#count ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/multi_model_paginator.rb', line 17 def count @cached_count ||= if @count.nil? @query.count else @count.call end end |
#with_select ⇒ Object
13 14 15 |
# File 'lib/multi_model_paginator.rb', line 13 def with_select @query.select(@select) end |