Module: Dbwatcher::SessionHelper
- Included in:
- ApplicationHelper
- Defined in:
- app/helpers/dbwatcher/session_helper.rb
Instance Method Summary collapse
-
#display_session_id(id) ⇒ Object
Generate session ID display (wider format).
-
#display_session_name(name) ⇒ Object
Format session name for display.
-
#session_active?(session) ⇒ Boolean
Determine if session is active.
-
#session_change_count(session) ⇒ Object
Get session change count with fallback.
Instance Method Details
#display_session_id(id) ⇒ Object
Generate session ID display (wider format)
21 22 23 24 25 26 |
# File 'app/helpers/dbwatcher/session_helper.rb', line 21 def display_session_id(id) return "N/A" unless id # Show more characters of the session ID for better readability "#{id[0..15]}..." end |
#display_session_name(name) ⇒ Object
Format session name for display
16 17 18 |
# File 'app/helpers/dbwatcher/session_helper.rb', line 16 def display_session_name(name) name.to_s.gsub(/^HTTP \w+ /, "") end |
#session_active?(session) ⇒ Boolean
Determine if session is active
11 12 13 |
# File 'app/helpers/dbwatcher/session_helper.rb', line 11 def session_active?(session) safe_value(session, :ended_at).blank? end |
#session_change_count(session) ⇒ Object
Get session change count with fallback
6 7 8 |
# File 'app/helpers/dbwatcher/session_helper.rb', line 6 def session_change_count(session) safe_value(session, :change_count, 0).to_i end |