Class: SlowActions::Controller

Inherits:
Object
  • Object
show all
Includes:
Computable
Defined in:
lib/slow_actions/slow_actions_controller.rb

Overview

Class to hold all #LogEntry objects that are associated with this #Controller.

Instance Attribute Summary collapse

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

Methods included from Computable

#compute_times

Constructor Details

#initialize(name) ⇒ Controller

Create a new #Controller

name: The name of the #Controller


9
10
11
12
13
# File 'lib/slow_actions/slow_actions_controller.rb', line 9

def initialize(name)
  @name = name
  @log_entries = []
  @actions = []
end

Instance Attribute Details

#actionsObject (readonly)

All the #Actions under this #Controller



30
31
32
# File 'lib/slow_actions/slow_actions_controller.rb', line 30

def actions
  @actions
end

#log_entriesObject (readonly)

All the #LogEntry objects associated with this #Controller



23
24
25
# File 'lib/slow_actions/slow_actions_controller.rb', line 23

def log_entries
  @log_entries
end

#nameObject (readonly)

Name of the #Controller



15
16
17
# File 'lib/slow_actions/slow_actions_controller.rb', line 15

def name
  @name
end

Instance Method Details

#add_action(a) ⇒ Object

Add an #Action as a child of this #Controller



26
27
28
# File 'lib/slow_actions/slow_actions_controller.rb', line 26

def add_action(a)
  @actions << a
end

#add_entry(la) ⇒ Object

Add a #LogEntry to this #Controller



18
19
20
21
# File 'lib/slow_actions/slow_actions_controller.rb', line 18

def add_entry(la)
  @log_entries << la
  la.controller = self
end

#to_sObject



32
33
34
# File 'lib/slow_actions/slow_actions_controller.rb', line 32

def to_s
  @name
end