class RailsBand::BaseEvent
The base class of each Event class.
Attributes
allocations[R]
children[R]
cpu_time[R]
duration[R]
end[R]
idle_time[R]
name[R]
time[R]
transaction_id[R]
Public Class Methods
new(event)
click to toggle source
@param event [ActiveSupport::Notifications::Event]
# File lib/rails_band/base_event.rb, line 10 def initialize(event) @event = event @name = event.name @time = event.time @end = event.end @transaction_id = event.transaction_id @children = event.children @cpu_time = event.cpu_time @idle_time = event.idle_time @allocations = event.allocations @duration = event.duration end
Public Instance Methods
slice(*args)
click to toggle source
# File lib/rails_band/base_event.rb, line 34 def slice(*args) to_h.slice(*args) end
to_h()
click to toggle source
# File lib/rails_band/base_event.rb, line 23 def to_h @to_h ||= { name: @name, time: @time, end: @end, transaction_id: @transaction_id, children: @children, cpu_time: @cpu_time, idle_time: @idle_time, allocations: @allocations, duration: @duration }.merge!( public_methods(false).reject { |meth| non_hash_keys.include?(meth) }.each_with_object({}) do |meth, h| h[meth] = public_send(meth) end ) end
Private Instance Methods
non_hash_keys()
click to toggle source
# File lib/rails_band/base_event.rb, line 40 def non_hash_keys @non_hash_keys ||= [] end