Class: ActiveSet::Paginating::EnumerableStrategy
- Inherits:
-
Object
- Object
- ActiveSet::Paginating::EnumerableStrategy
- Defined in:
- lib/active_set/paginating/enumerable_strategy.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(set, operation_instructions) ⇒ EnumerableStrategy
constructor
A new instance of EnumerableStrategy.
Constructor Details
#initialize(set, operation_instructions) ⇒ EnumerableStrategy
Returns a new instance of EnumerableStrategy.
6 7 8 9 |
# File 'lib/active_set/paginating/enumerable_strategy.rb', line 6 def initialize(set, operation_instructions) @set = set @operation_instructions = operation_instructions end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 |
# File 'lib/active_set/paginating/enumerable_strategy.rb', line 11 def execute return [] if @set.count <= @operation_instructions[:size] && @operation_instructions[:page] > 1 @set[page_start..page_end] || [] end |