Class: RuntimeProfiler::Callback::ActiveRecord
- Inherits:
-
Object
- Object
- RuntimeProfiler::Callback::ActiveRecord
- Defined in:
- lib/runtime_profiler/callbacks/active_record.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize ⇒ ActiveRecord
constructor
A new instance of ActiveRecord.
Constructor Details
#initialize ⇒ ActiveRecord
8 9 10 |
# File 'lib/runtime_profiler/callbacks/active_record.rb', line 8 def initialize @data = {} end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/runtime_profiler/callbacks/active_record.rb', line 6 def data @data end |
Instance Method Details
#call(*args) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/runtime_profiler/callbacks/active_record.rb', line 12 def call(*args) event = RuntimeProfiler::SqlEvent.new(args: args, trace: caller) return unless event.recordable? return if event.trace.empty? @data.key?(event.key) ? update(event) : add(event) end |