Class: Timber::Contexts::Session
- Inherits:
-
Timber::Context
- Object
- Timber::Context
- Timber::Contexts::Session
- Defined in:
- lib/timber/contexts/session.rb
Overview
Note:
This is tracked automatically with the Integrations::Rack::SessionContext rack middleware.
The session context tracks the current session for the given user.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #as_json(_options = {}) ⇒ Object
-
#initialize(attributes) ⇒ Session
constructor
A new instance of Session.
Constructor Details
#initialize(attributes) ⇒ Session
Returns a new instance of Session.
12 13 14 |
# File 'lib/timber/contexts/session.rb', line 12 def initialize(attributes) @id = attributes[:id] || raise(ArgumentError.new(":id is required")) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/timber/contexts/session.rb', line 10 def id @id end |
Instance Method Details
#as_json(_options = {}) ⇒ Object
16 17 18 |
# File 'lib/timber/contexts/session.rb', line 16 def as_json( = {}) {id: Timber::Util::Object.try(id, :to_s)} end |