Class: Logtail::Events::ControllerCall
- Inherits:
-
Logtail::Event
- Object
- Logtail::Event
- Logtail::Events::ControllerCall
- Defined in:
- lib/logtail/events/controller_call.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#params_json ⇒ Object
readonly
Returns the value of attribute params_json.
Attributes inherited from Logtail::Event
Instance Method Summary collapse
-
#initialize(attributes) ⇒ ControllerCall
constructor
A new instance of ControllerCall.
- #message ⇒ Object
- #to_hash ⇒ Object
Methods inherited from Logtail::Event
#inspect, #to_json, #to_msgpack, #to_s
Constructor Details
#initialize(attributes) ⇒ ControllerCall
Returns a new instance of ControllerCall.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/logtail/events/controller_call.rb', line 10 def initialize(attributes) @controller = attributes[:controller] @action = attributes[:action] @params = attributes[:params] if @params @params_json = @params.to_json end @format = attributes[:format] end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
8 9 10 |
# File 'lib/logtail/events/controller_call.rb', line 8 def action @action end |
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
8 9 10 |
# File 'lib/logtail/events/controller_call.rb', line 8 def controller @controller end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
8 9 10 |
# File 'lib/logtail/events/controller_call.rb', line 8 def format @format end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
8 9 10 |
# File 'lib/logtail/events/controller_call.rb', line 8 def params @params end |
#params_json ⇒ Object (readonly)
Returns the value of attribute params_json.
8 9 10 |
# File 'lib/logtail/events/controller_call.rb', line 8 def params_json @params_json end |
Instance Method Details
#message ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/logtail/events/controller_call.rb', line 22 def = "Processing by #{controller}##{action}" if !.nil? << " as #{format}" end if !params.nil? && params.length > 0 << "\n Parameters: #{params.inspect}" end end |
#to_hash ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/logtail/events/controller_call.rb', line 33 def to_hash { controller_called: Util::NonNilHashBuilder.build do |h| h.add(:controller, controller) h.add(:action, action) h.add(:params_json, params_json) end } end |