Class: Timber::Contexts::System
- Inherits:
-
Timber::Context
- Object
- Timber::Context
- Timber::Contexts::System
- Defined in:
- lib/timber/contexts/system.rb
Overview
Tracks OS level process information, such as the process ID.
Instance Attribute Summary collapse
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
Instance Method Summary collapse
- #as_json(_options = {}) ⇒ Object
-
#initialize(attributes) ⇒ System
constructor
A new instance of System.
Constructor Details
#initialize(attributes) ⇒ System
Returns a new instance of System.
9 10 11 12 13 |
# File 'lib/timber/contexts/system.rb', line 9 def initialize(attributes) @hostname = attributes[:hostname] @pid = attributes[:pid] @pid = @pid.to_s end |
Instance Attribute Details
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
7 8 9 |
# File 'lib/timber/contexts/system.rb', line 7 def hostname @hostname end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
7 8 9 |
# File 'lib/timber/contexts/system.rb', line 7 def pid @pid end |
Instance Method Details
#as_json(_options = {}) ⇒ Object
15 16 17 |
# File 'lib/timber/contexts/system.rb', line 15 def as_json( = {}) {hostname: hostname, pid: Timber::Util::Object.try(pid, :to_s)} end |