Class: RailsBand::ActiveRecord::Event::Sql

Inherits:
BaseEvent
  • Object
show all
Defined in:
lib/rails_band/active_record/event/sql.rb

Overview

A wrapper for the event that is passed to sql.active_record.

Instance Attribute Summary

Attributes inherited from BaseEvent

#allocations, #cpu_time, #duration, #end, #idle_time, #name, #time, #transaction_id

Instance Method Summary collapse

Methods inherited from BaseEvent

#initialize, #slice, #to_h

Constructor Details

This class inherits a constructor from RailsBand::BaseEvent

Instance Method Details

#async ⇒ Object



35
36
37
38
39
# File 'lib/rails_band/active_record/event/sql.rb', line 35

def async
  return @async if defined? @async

  @async = @event.payload[:async]
end

#binds ⇒ Object



17
18
19
# File 'lib/rails_band/active_record/event/sql.rb', line 17

def binds
  @binds ||= @event.payload.fetch(:binds)
end

#cached ⇒ Object



41
42
43
44
45
# File 'lib/rails_band/active_record/event/sql.rb', line 41

def cached
  return @cached if defined? @cached

  @cached = @event.payload[:cached]
end

#connection ⇒ Object



25
26
27
# File 'lib/rails_band/active_record/event/sql.rb', line 25

def connection
  @connection ||= @event.payload.fetch(:connection)
end

#sql ⇒ Object



8
9
10
# File 'lib/rails_band/active_record/event/sql.rb', line 8

def sql
  @sql ||= @event.payload.fetch(:sql)
end

#sql_name ⇒ Object

Note:

This method is renamed in order to avoid conflicts with BaseEvent#name.



13
14
15
# File 'lib/rails_band/active_record/event/sql.rb', line 13

def sql_name
  @sql_name ||= @event.payload.fetch(:name)
end

#statement_name ⇒ Object



29
30
31
32
33
# File 'lib/rails_band/active_record/event/sql.rb', line 29

def statement_name
  return @statement_name if defined? @statement_name

  @statement_name = @event.payload[:statement_name]
end

#type_casted_binds ⇒ Object



21
22
23
# File 'lib/rails_band/active_record/event/sql.rb', line 21

def type_casted_binds
  @type_casted_binds ||= @event.payload.fetch(:type_casted_binds)
end