module WebTools::Support::AppModel

This is a ViewModel for the WebTools Application.

All of the methods that return “Objects” should return a Hash. Keys beginning with '_' are reserved for metadata applied by the GUI.

Constants

SESSION_FIELDS

An array of [name, description] entries for the fields in the session report.

VERSION_HEADERS

Public Instance Methods

session_report() 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/support/app_model.rb, line 64
def session_report
  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
version_report() 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/support/app_model.rb, line 26
def version_report
  stone_rpt = stone_version_report
  gem_rpt = gem_version_report
  data = { }
  (stone_rpt.keys + gem_rpt.keys).each do |k|
    g = stone_rpt[k] == gem_rpt[k] ? '' : gem_rpt[k]
    data[k] = [stone_rpt[k], g]
  end
  { :timestamp => Time.now.asctime,
    :headers   => VERSION_HEADERS,
    :report    => data }
end