class Traildb::TrailDBCursor
Public Class Methods
new(cursor, cls, valuefun, parsetime, only_timestamp, event_filter_obj)
click to toggle source
Calls superclass method
# File lib/traildb.rb, line 183 def initialize(cursor, cls, valuefun, parsetime, only_timestamp, event_filter_obj) super cursor @cls = cls @valuefun = valuefun @parsetime = parsetime @only_timestamp = only_timestamp if event_filter_obj @event_filter_obj = event_filter_obj ret = Traildb.tdb_cursor_set_event_filter(self, event_filter_obj) raise TrailDBError.new("cursor_set_event_filter failed", ret) if ret != 0 end end
release(ptr)
click to toggle source
# File lib/traildb.rb, line 211 def self.release(ptr) Trailsdb.tdb_cursor_free(ptr) end
Public Instance Methods
each() { |timestamp| ... }
click to toggle source
# File lib/traildb.rb, line 196 def each loop do event = Traildb.tdb_cursor_next(self) break if event.null? timestamp = event[:timestamp] timestamp = Time.at(timestamp) if @parsetime if @only_timestamp yield timestamp else items = event.tdb_items(@valuefun) yield @cls.new(timestamp, *items) end end end