Class: Call

Inherits:
Object
  • Object
show all
Defined in:
lib/call.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ Call

Returns a new instance of Call.



5
6
7
8
9
10
# File 'lib/call.rb', line 5

def initialize(event)
  @start_time = Time.now.to_f
  @class_id = event.defined_class
  @method_id = event.method_id
  @key = generate_key
end

Instance Attribute Details

#class_idObject (readonly)

Returns the value of attribute class_id.



2
3
4
# File 'lib/call.rb', line 2

def class_id
  @class_id
end

#finish_timeObject

Returns the value of attribute finish_time.



3
4
5
# File 'lib/call.rb', line 3

def finish_time
  @finish_time
end

#keyObject (readonly)

Returns the value of attribute key.



2
3
4
# File 'lib/call.rb', line 2

def key
  @key
end

#method_idObject (readonly)

Returns the value of attribute method_id.



2
3
4
# File 'lib/call.rb', line 2

def method_id
  @method_id
end

#start_timeObject

Returns the value of attribute start_time.



3
4
5
# File 'lib/call.rb', line 3

def start_time
  @start_time
end

Instance Method Details

#execute_timeObject



17
18
19
# File 'lib/call.rb', line 17

def execute_time
  @finish_time.to_f - @start_time
end

#finishObject



12
13
14
15
# File 'lib/call.rb', line 12

def finish
  @finish_time ||= Time.now.to_f
  execute_time
end

#key?(key) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/call.rb', line 21

def key?(key)
  @key == key
end