Class: SlowActions::Action
- Inherits:
-
Object
- Object
- SlowActions::Action
- Includes:
- Computable
- Defined in:
- lib/slow_actions/slow_actions_action.rb
Overview
Class to hold all #LogEntry objects that are associated with this individual #Action on a #Controller
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
#Controller of this #Action.
-
#log_entries ⇒ Object
readonly
All the #LogEntry objects this #Action holds.
-
#name ⇒ Object
readonly
Name of this #Action.
Attributes included from Computable
#db_avg, #db_cost, #db_max, #error_avg, #render_avg, #render_cost, #render_max, #total_avg, #total_cost, #total_max
Instance Method Summary collapse
-
#add_entry(la) ⇒ Object
Add a log entry to this #Action.
-
#initialize(name, controller) ⇒ Action
constructor
Create a new #Action object.
- #to_s ⇒ Object
Methods included from Computable
Constructor Details
#initialize(name, controller) ⇒ Action
Create a new #Action object.
name: the #name of the #Action. i.e. "new"
controller: the #Controller this #Action is a part of
10 11 12 13 14 |
# File 'lib/slow_actions/slow_actions_action.rb', line 10 def initialize(name, controller) @name = name @controller = controller @log_entries = [] end |
Instance Attribute Details
#controller ⇒ Object (readonly)
#Controller of this #Action
19 20 21 |
# File 'lib/slow_actions/slow_actions_action.rb', line 19 def controller @controller end |
#log_entries ⇒ Object (readonly)
All the #LogEntry objects this #Action holds
27 28 29 |
# File 'lib/slow_actions/slow_actions_action.rb', line 27 def log_entries @log_entries end |
#name ⇒ Object (readonly)
Name of this #Action
17 18 19 |
# File 'lib/slow_actions/slow_actions_action.rb', line 17 def name @name end |
Instance Method Details
#add_entry(la) ⇒ Object
Add a log entry to this #Action
22 23 24 25 |
# File 'lib/slow_actions/slow_actions_action.rb', line 22 def add_entry(la) @log_entries << la la.action = self end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/slow_actions/slow_actions_action.rb', line 29 def to_s @name end |