Class: ActiveSupport::Notifications::Event

Inherits:
Object
  • Object
show all
Defined in:
activesupport/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
# File 'activesupport/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       = []
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children



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

def children
  @children
end

#endObject

Returns the value of attribute end



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

def end
  @end
end

#nameObject (readonly)

Returns the value of attribute name



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

def name
  @name
end

#payloadObject (readonly)

Returns the value of attribute payload



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

def payload
  @payload
end

#timeObject (readonly)

Returns the value of attribute time



47
48
49
# File 'activesupport/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 'activesupport/lib/active_support/notifications/instrumenter.rb', line 47

def transaction_id
  @transaction_id
end

Instance Method Details

#<<(event) ⇒ Object



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

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

#durationObject



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

def duration
  1000.0 * (self.end - time)
end

#parent_of?(event) ⇒ Boolean

Returns:

  • (Boolean)


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

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