Class: Logtail::Contexts::Session

Inherits:
Logtail::Context show all
Defined in:
lib/logtail/contexts/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Session

Returns a new instance of Session.



10
11
12
# File 'lib/logtail/contexts/session.rb', line 10

def initialize(attributes)
  @id = attributes[:id]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/logtail/contexts/session.rb', line 8

def id
  @id
end

Instance Method Details

#to_hashObject

Builds a hash representation containing simple objects, suitable for serialization (JSON).



15
16
17
18
19
20
21
# File 'lib/logtail/contexts/session.rb', line 15

def to_hash
  @to_hash ||= {
    session: Util::NonNilHashBuilder.build do |h|
      h.add(:id, id)
    end
  }
end