Class: ActionTracer::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/action_tracer/filters.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, method:) ⇒ Action

Returns a new instance of Action.



26
27
28
29
# File 'lib/action_tracer/filters.rb', line 26

def initialize(name:, method:)
  @name = name
  @method = method
end

Class Method Details

.build(controller) ⇒ Object



31
32
33
34
# File 'lib/action_tracer/filters.rb', line 31

def self.build(controller)
  method = controller.respond_to?(controller.action_name) ? controller.method(controller.action_name) : nil_method
  new(name: controller.action_name, method: method)
end

Instance Method Details

#to_aObject



36
37
38
# File 'lib/action_tracer/filters.rb', line 36

def to_a
  [APPLIED[:action], @name, *@method.source_location]
end