Class: EasyHook::HookTimer::Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/easy-hook.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTimer

Returns a new instance of Timer.



25
26
27
28
29
# File 'lib/easy-hook.rb', line 25

def initialize
  @start = Time.now
  @time = nil
  Timer.register(self)
end

Class Attribute Details

.idsObject

Returns the value of attribute ids.



8
9
10
# File 'lib/easy-hook.rb', line 8

def ids
  @ids
end

Instance Attribute Details

#startObject

Returns the value of attribute start.



23
24
25
# File 'lib/easy-hook.rb', line 23

def start
  @start
end

#timeObject

Returns the value of attribute time.



23
24
25
# File 'lib/easy-hook.rb', line 23

def time
  @time
end

Class Method Details

.finalize(id) ⇒ Object



10
11
12
# File 'lib/easy-hook.rb', line 10

def finalize(id)
  @ids.delete(id)
end

.register(obj) ⇒ Object



14
15
16
17
18
# File 'lib/easy-hook.rb', line 14

def register(obj)
  @ids ||= Set.new
  @ids << obj.object_id
  ObjectSpace.define_finalizer(obj, method(:finalize))
end