Class: CleverSequence::LowerBoundFinder
- Inherits:
-
Struct
- Object
- Struct
- CleverSequence::LowerBoundFinder
- Defined in:
- lib/demo_mode/clever_sequence.rb
Instance Method Summary collapse
Instance Method Details
#lower_bound(current = 1, lower = 0, upper = Float::INFINITY) ⇒ Object
76 77 78 79 80 81 82 83 84 |
# File 'lib/demo_mode/clever_sequence.rb', line 76 def lower_bound(current = 1, lower = 0, upper = Float::INFINITY) if exists?(current) lower_bound(next_between(current, upper), [current, lower].max, upper) elsif current - lower > 1 lower_bound(next_between(lower, current), lower, [current, upper].min) else # current should == lower + 1 lower end end |