Class: SlowActions::Session

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

Overview

Class to hold and #LogEntry objects that are associated with this individual Session ID

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) ⇒ Session

Create a new session

name: the session_id


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

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

Instance Attribute Details

#log_entriesObject (readonly)

All the #LogEntry objects this #Session holds



22
23
24
# File 'lib/slow_actions/slow_actions_session.rb', line 22

def log_entries
  @log_entries
end

#nameObject (readonly)

The session_id



14
15
16
# File 'lib/slow_actions/slow_actions_session.rb', line 14

def name
  @name
end

Instance Method Details

#add_entry(la) ⇒ Object

Add a #LogEntry to this #Session



17
18
19
20
# File 'lib/slow_actions/slow_actions_session.rb', line 17

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