Top Level Namespace
Defined Under Namespace
Classes: AsyncDataProvider
Instance Method Summary collapse
-
#thread ⇒ Object
AsyncDataProvider allows the user to update data in the background on a schedule and return the most recent data it knows about.
Instance Method Details
#thread ⇒ Object
AsyncDataProvider allows the user to update data in the background on a schedule and return the most recent data it knows about. The provider will return nil until data is found for the first time
User of this class should subclass it, implement the time_retrieve_interval, and implment update_data.
Examples
class SomeSqlData < AsyncDataProvider
def initialize
super()
@time_retrieve_interval = 120
@query = "\"SELECT some_data FROM some_table WHERE some_condition > 0;\""
end
def update_data(**args)
sql = Sql.new
return sql.query(@query)
end
end
24 |
# File 'lib/async_data_provider.rb', line 24 require 'thread' |