class Logtail::Events::ControllerCall

@private

Attributes

action[R]
controller[R]
format[R]
params[R]
params_json[R]

Public Class Methods

new(attributes) click to toggle source
# 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

Public Instance Methods

message() click to toggle source
# File lib/logtail/events/controller_call.rb, line 22
def message
  message = "Processing by #{controller}##{action}"
  if !message.nil?
    message << " as #{format}"
  end
  if !params.nil? && params.length > 0
    message << "\n  Parameters: #{params.inspect}"
  end
  message
end
to_hash() click to toggle source
# 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