class RxRuby::LocalScheduler
Abstract base class for machine-local schedulers, using the local system clock for time-based operations.
Public Instance Methods
now()
click to toggle source
Gets the scheduler’s notion of current time.
# File lib/rx_ruby/concurrency/local_scheduler.rb, line 12 def now Time.now end
schedule_absolute_with_state(state, due_time, action)
click to toggle source
Schedules an action to be executed at dueTime.
# File lib/rx_ruby/concurrency/local_scheduler.rb, line 24 def schedule_absolute_with_state(state, due_time, action) raise 'action cannot be nil' unless action schedule_relative_with_state(state, (due_time - self.now), action) end
schedule_relative_with_state(state, due_time, action)
click to toggle source
# File lib/rx_ruby/concurrency/local_scheduler.rb, line 30 def schedule_relative_with_state(state, due_time, action) raise ArgumentError.new 'action cannot be nil' unless action dt = RxRuby::Scheduler.normalize due_time sleep dt if dt > 0 action.call(self, state) end
schedule_with_state(state, action)
click to toggle source
Schedules an action to be executed.
# File lib/rx_ruby/concurrency/local_scheduler.rb, line 17 def schedule_with_state(state, action) raise 'action cannot be nil' unless action schedule_relative_with_state(state, 0, action) end