class Poller::Timeout

Public Class Methods

new(period_seconds) click to toggle source

Specify the timeout period in Integer or Floating Point representation

period_seconds

The timeout period in seconds

# File lib/poller/timeout.rb, line 6
def initialize(period_seconds)
  @period = period_seconds
  @start_time = Time.now
end

Public Instance Methods

occured?() click to toggle source

Returns true if timeout period has elapsed

# File lib/poller/timeout.rb, line 12
def occured?
  Time.now - @start_time >= @period
end