Class: Stenotype::ContextHandlers::Rails::Controller

Inherits:
Base
  • Object
show all
Defined in:
lib/stenotype/context_handlers/rails/controller.rb

Overview

ActionController handler to support fetching data out of a rails controller instance

Instance Attribute Summary

Attributes inherited from Base

#context, #options

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize

Constructor Details

This class inherits a constructor from Stenotype::ContextHandlers::Base

Instance Method Details

#as_json(*_args) ⇒ Hash

Returns a JSON representation of controller's data.

Returns:

  • (Hash)

    a JSON representation of controller's data



15
16
17
18
19
20
21
22
23
24
# File 'lib/stenotype/context_handlers/rails/controller.rb', line 15

def as_json(*_args)
  {
    class: controller_class.name,
    method: method,
    url: url,
    referer: referer,
    params: params.except("controller", "action"),
    ip: remote_ip,
  }
end