Sha256: 72498562e02f4bbd7cafaed8c1ee6ea9922260d98b3a5c3a50b09ed68577777b
Contents?: true
Size: 824 Bytes
Versions: 2
Compression:
Stored size: 824 Bytes
Contents
require "timber/context" require "timber/util" module Timber module Contexts # The system context tracks OS level process information, such as the process ID. # # @note This is tracked automatically in {CurrentContext}. When the current context # is initialized, the system context gets added automatically. class System < Context attr_reader :hostname, :pid def initialize(attributes) @hostname = attributes[:hostname] @pid = attributes[:pid] end # Builds a hash representation containing simple objects, suitable for serialization (JSON). def to_hash @to_hash ||= { system: Util::NonNilHashBuilder.build do |h| h.add(:hostname, hostname) h.add(:pid, pid) end } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
timber-3.0.1 | lib/timber/contexts/system.rb |
timber-3.0.0 | lib/timber/contexts/system.rb |