123456789_123456789_123456789_123456789_123456789_

Class: TypeProf::Utils::TimerCancelToken

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, CancelToken
Instance Chain:
self, CancelToken
Inherits: TypeProf::Utils::CancelToken
Defined in: lib/typeprof/utils.rb

Class Method Summary

Instance Attribute Summary

Constructor Details

.new(max_sec) ⇒ TimerCancelToken

[ GitHub ]

  
# File 'lib/typeprof/utils.rb', line 202

def initialize(max_sec)
  @max_sec = max_sec
  @start_time = Time.now
end

Instance Attribute Details

#cancelled?Boolean (readonly)

[ GitHub ]

  
# File 'lib/typeprof/utils.rb', line 207

def cancelled?
  @max_sec && Time.now - @start_time >= @max_sec
end