Class: Footnotes::Notes::QuerySubscriberNotifactionEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/rails-footnotes/notes/queries_note.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event, ctrace) ⇒ QuerySubscriberNotifactionEvent

Returns a new instance of QuerySubscriberNotifactionEvent.



84
85
86
# File 'lib/rails-footnotes/notes/queries_note.rb', line 84

def initialize(event, ctrace)
  @event, @ctrace, @query = event, ctrace, event.payload[:sql]
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



81
82
83
# File 'lib/rails-footnotes/notes/queries_note.rb', line 81

def event
  @event
end

#queryObject (readonly)

Returns the value of attribute query.



81
82
83
# File 'lib/rails-footnotes/notes/queries_note.rb', line 81

def query
  @query
end

#traceObject (readonly)

Returns the value of attribute trace.



81
82
83
# File 'lib/rails-footnotes/notes/queries_note.rb', line 81

def trace
  @trace
end

Instance Method Details

#typeObject



92
93
94
95
# File 'lib/rails-footnotes/notes/queries_note.rb', line 92

def type
  return @type if @type
  @type = self.query.match(/^(select|insert|update|delete|alter)\b/i) || 'Unknown'
end