Class: ActiveSupport::Notifications::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/active_support/notifications/instrumenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, start, ending, transaction_id, payload) ⇒ Event

Returns a new instance of Event.



50
51
52
53
54
55
56
57
58
# File 'lib/active_support/notifications/instrumenter.rb', line 50

def initialize(name, start, ending, transaction_id, payload)
  @name           = name
  @payload        = payload.dup
  @time           = start
  @transaction_id = transaction_id
  @end            = ending
  @children       = []
  @duration       = nil
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



47
48
49
# File 'lib/active_support/notifications/instrumenter.rb', line 47

def children
  @children
end

#endObject

Returns the value of attribute end.



48
49
50
# File 'lib/active_support/notifications/instrumenter.rb', line 48

def end
  @end
end

#nameObject (readonly)

Returns the value of attribute name.



47
48
49
# File 'lib/active_support/notifications/instrumenter.rb', line 47

def name
  @name
end

#payloadObject (readonly)

Returns the value of attribute payload.



47
48
49
# File 'lib/active_support/notifications/instrumenter.rb', line 47

def payload
  @payload
end

#timeObject (readonly)

Returns the value of attribute time.



47
48
49
# File 'lib/active_support/notifications/instrumenter.rb', line 47

def time
  @time
end

#transaction_idObject (readonly)

Returns the value of attribute transaction_id.



47
48
49
# File 'lib/active_support/notifications/instrumenter.rb', line 47

def transaction_id
  @transaction_id
end

Instance Method Details

#<<(event) ⇒ Object



64
65
66
# File 'lib/active_support/notifications/instrumenter.rb', line 64

def <<(event)
  @children << event
end

#durationObject



60
61
62
# File 'lib/active_support/notifications/instrumenter.rb', line 60

def duration
  @duration ||= 1000.0 * (self.end - time)
end

#parent_of?(event) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/active_support/notifications/instrumenter.rb', line 68

def parent_of?(event)
  @children.include? event
end