Class: Kaminari::Logarithmic::Strategies::FixedStepsStrategy
- Inherits:
-
BaseStrategy
- Object
- BaseStrategy
- Kaminari::Logarithmic::Strategies::FixedStepsStrategy
- Defined in:
- lib/kaminari/logarithmic/strategies/fixed_steps_strategy.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(start, finish, base = 10) ⇒ FixedStepsStrategy
constructor
A new instance of FixedStepsStrategy.
Constructor Details
#initialize(start, finish, base = 10) ⇒ FixedStepsStrategy
Returns a new instance of FixedStepsStrategy.
5 6 7 8 9 |
# File 'lib/kaminari/logarithmic/strategies/fixed_steps_strategy.rb', line 5 def initialize(start, finish, base = 10) @global_start = start @global_finish = finish @base = base end |
Instance Method Details
#build ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/kaminari/logarithmic/strategies/fixed_steps_strategy.rb', line 11 def build start = next_point_or_itself(@global_start, @base) step = @base result = [] while enough?(start) finish = next_finish(start, step) result += seq_with_step(start, finish, step) start = next_point(finish, step * @base) step *= @base end result end |