Class: RailsBand::ActionController::Event::ProcessAction

Inherits:
BaseEvent
  • Object
show all
Defined in:
lib/rails_band/action_controller/event/process_action.rb

Overview

A wrapper for the event that is passed to process_action.action_controller.

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

#action ⇒ Object



12
13
14
# File 'lib/rails_band/action_controller/event/process_action.rb', line 12

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

#controller ⇒ Object



8
9
10
# File 'lib/rails_band/action_controller/event/process_action.rb', line 8

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

#db_runtime ⇒ Object



64
65
66
67
68
# File 'lib/rails_band/action_controller/event/process_action.rb', line 64

def db_runtime
  return @db_runtime if defined? @db_runtime

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

#format ⇒ Object



24
25
26
# File 'lib/rails_band/action_controller/event/process_action.rb', line 24

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

#headers ⇒ Object



20
21
22
# File 'lib/rails_band/action_controller/event/process_action.rb', line 20

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

#method ⇒ Object



28
29
30
# File 'lib/rails_band/action_controller/event/process_action.rb', line 28

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

#params ⇒ Object



16
17
18
# File 'lib/rails_band/action_controller/event/process_action.rb', line 16

def params
  @params ||= @event.payload.fetch(:params).except(*INTERNAL_PARAMS)
end

#path ⇒ Object



32
33
34
# File 'lib/rails_band/action_controller/event/process_action.rb', line 32

def path
  @path ||= @event.payload.fetch(:path).split('?', 2).first
end

#status ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rails_band/action_controller/event/process_action.rb', line 36

def status
  @status ||=
    begin
      status = @event.payload[:status]

      if status.nil? && (exception_class_name = @event.payload[:exception]&.first)
        status = ::ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_class_name)
      end
      status
    end
end

#view_runtime ⇒ Object



48
49
50
# File 'lib/rails_band/action_controller/event/process_action.rb', line 48

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