class WebTools::SessionList
Constants
- SECS_PER_DAY
- SECS_PER_HOUR
- SECS_PER_MIN
- SECS_PER_SEC
- SessionListLabels
See System class>>#'descriptionOfSession:'
Public Class Methods
description()
click to toggle source
# File lib/web_tools/session_list.rb, line 6 def self.description 'Information about current sessions and other processes' end
Public Instance Methods
format_secs(seconds)
click to toggle source
Format number of seconds like “3 days 12:07:58”
# File lib/web_tools/session_list.rb, line 89 def format_secs(seconds) splits = [] [SECS_PER_DAY, SECS_PER_HOUR, SECS_PER_MIN, SECS_PER_SEC].each do |x| splits << seconds / x seconds = seconds % x end days = splits.shift ts = "%02d:%02d:%02d" % splits days > 0 ? "#{days} #{days == 1 ? 'day' : 'days'} #{ts}" : ts end
non_session_list()
click to toggle source
# File lib/web_tools/session_list.rb, line 68 def non_session_list begin sessions = Maglev::System.current_session_ids.to_a slots = [] 1000.times do |slot| # Any number will do, theres a limited number of slots ary = Maglev::System.cache_statistics(slot).to_a unless sessions.include?(ary[2]) slots << [slot, ary.first] end end rescue Exception return slots end end
session_list()
click to toggle source
Returns a hash of configuration parameters for the stone and the gem. The has has three keys:
+ :timestamp => when the report was generated + :headers => array of [name, description] pairs for the fields + :report => An array of data. Each entry is an array of the field data.
# File lib/web_tools/session_list.rb, line 51 def session_list ts = Time.now now = ts.to_i session_info = Maglev::System.current_session_ids.map do |id| sess_desc = Maglev::System.description_of_session id sess_desc[0] = sess_desc[0].instance_variable_get(:@_st_userId) # UserProfile sess_desc[3] = '' if sess_desc[3] == 0 # Primitive? sess_desc[4] = format_secs(now - sess_desc[4]) # View Age sess_desc[6] = ['none', 'out', 'in'][sess_desc[6] + 1] # Transaction sess_desc[13] = format_secs(now - sess_desc[13]) # Quiet sess_desc[14] = format_secs(now - sess_desc[14]) # Age sess_desc # sess_cache_slot = Maglev::System.cache_slot_for_sessionid id end session_info end