Sha256: 044efb6e1f6347a454c0f8b52709e8a5c64a898fe9bdc148ddd15211c45746b1

Contents?: true

Size: 625 Bytes

Versions: 5

Compression:

Stored size: 625 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.
    class System < Context
      @keyspace = :system

      attr_reader :hostname, :pid

      def initialize(attributes)
        @hostname = attributes[:hostname]
        @pid = attributes[:pid]
        @pid = @pid.to_s
      end

      # Builds a hash representation of containing simply objects, suitable for serialization.
      def as_json(_options = {})
        {hostname: hostname, pid: Timber::Util::Object.try(pid, :to_s)}
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
timber-2.1.0.rc5 lib/timber/contexts/system.rb
timber-2.1.0.rc4 lib/timber/contexts/system.rb
timber-2.1.0.rc3 lib/timber/contexts/system.rb
timber-2.1.0.rc2 lib/timber/contexts/system.rb
timber-2.1.0.rc1 lib/timber/contexts/system.rb