Class: Logtail::Contexts::Runtime

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Runtime

Returns a new instance of Runtime.



9
10
11
# File 'lib/logtail/contexts/runtime.rb', line 9

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

Instance Attribute Details

#thread_idObject (readonly)

Returns the value of attribute thread_id.



7
8
9
# File 'lib/logtail/contexts/runtime.rb', line 7

def thread_id
  @thread_id
end

Instance Method Details

#to_hashObject

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



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

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