Class: DripCursor
- Inherits:
-
Object
- Object
- DripCursor
- Defined in:
- lib/my_drip.rb
Instance Attribute Summary collapse
-
#cur ⇒ Object
Returns the value of attribute cur.
Instance Method Summary collapse
-
#initialize(drip, bufsiz = 10, at_least = 10) ⇒ DripCursor
constructor
A new instance of DripCursor.
- #now ⇒ Object
- #past_each(tag = nil) ⇒ Object
- #seek_at(time) ⇒ Object
Constructor Details
#initialize(drip, bufsiz = 10, at_least = 10) ⇒ DripCursor
Returns a new instance of DripCursor.
45 46 47 48 49 50 |
# File 'lib/my_drip.rb', line 45 def initialize(drip, bufsiz=10, at_least=10) @drip = drip @cur = nil @bufsiz = bufsiz @at_least = at_least end |
Instance Attribute Details
#cur ⇒ Object
Returns the value of attribute cur.
51 52 53 |
# File 'lib/my_drip.rb', line 51 def cur @cur end |
Instance Method Details
#now ⇒ Object
53 54 55 |
# File 'lib/my_drip.rb', line 53 def now @cur ? @drip.key_to_time(@cur) : nil end |
#past_each(tag = nil) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/my_drip.rb', line 61 def past_each(tag=nil) while kv = @drip.older(@cur, tag) @cur, value = kv yield(value) end end |
#seek_at(time) ⇒ Object
57 58 59 |
# File 'lib/my_drip.rb', line 57 def seek_at(time) @cur = @drip.time_to_key(time) end |