Class: Cursor
- Inherits:
-
Object
- Object
- Cursor
- Defined in:
- lib/quantile_estimator/cursor.rb
Instance Method Summary (collapse)
-
- (Cursor) initialize(array, start = 0)
constructor
A new instance of Cursor.
- - (Object) next
- - (Object) previous
- - (Object) remove!
- - (Object) ~
Constructor Details
- (Cursor) initialize(array, start = 0)
Returns a new instance of Cursor
2 3 4 5 |
# File 'lib/quantile_estimator/cursor.rb', line 2 def initialize(array, start=0) @array = array @start = start end |
Instance Method Details
- (Object) next
17 18 19 |
# File 'lib/quantile_estimator/cursor.rb', line 17 def next Cursor.new(@array, @start + 1) end |
- (Object) previous
21 22 23 |
# File 'lib/quantile_estimator/cursor.rb', line 21 def previous Cursor.new(@array, @start - 1) end |
- (Object) remove!
13 14 15 |
# File 'lib/quantile_estimator/cursor.rb', line 13 def remove! @array.delete_at(@start) end |
- (Object) ~
7 8 9 10 11 |
# File 'lib/quantile_estimator/cursor.rb', line 7 def ~ if @start >= 0 @array[@start] end end |