Class: Skein::Context
- Inherits:
-
Object
- Object
- Skein::Context
- Defined in:
- lib/skein/context.rb
Instance Attribute Summary collapse
-
#hostname ⇒ Object
readonly
Properties ===========================================================.
-
#process_id ⇒ Object
readonly
Returns the value of attribute process_id.
-
#process_name ⇒ Object
readonly
Returns the value of attribute process_name.
-
#reporter ⇒ Object
Returns the value of attribute reporter.
Class Method Summary collapse
-
.default ⇒ Object
Class Methods ========================================================.
Instance Method Summary collapse
- #exception!(*args) ⇒ Object
- #ident(object) ⇒ Object
-
#initialize(hostname: nil, process_name: nil, process_id: nil, config: nil) ⇒ Context
constructor
Instance Methods =====================================================.
- #trap ⇒ Object
Constructor Details
#initialize(hostname: nil, process_name: nil, process_id: nil, config: nil) ⇒ Context
Instance Methods =====================================================
17 18 19 20 21 |
# File 'lib/skein/context.rb', line 17 def initialize(hostname: nil, process_name: nil, process_id: nil, config: nil) @hostname = (hostname || Skein::Support.hostname).dup.freeze @process_name = (process_name || Skein::Support.process_name).dup.freeze @process_id = process_id || Skein::Support.process_id end |
Instance Attribute Details
#hostname ⇒ Object (readonly)
Properties ===========================================================
4 5 6 |
# File 'lib/skein/context.rb', line 4 def hostname @hostname end |
#process_id ⇒ Object (readonly)
Returns the value of attribute process_id.
6 7 8 |
# File 'lib/skein/context.rb', line 6 def process_id @process_id end |
#process_name ⇒ Object (readonly)
Returns the value of attribute process_name.
5 6 7 |
# File 'lib/skein/context.rb', line 5 def process_name @process_name end |
#reporter ⇒ Object
Returns the value of attribute reporter.
7 8 9 |
# File 'lib/skein/context.rb', line 7 def reporter @reporter end |
Class Method Details
.default ⇒ Object
Class Methods ========================================================
11 12 13 |
# File 'lib/skein/context.rb', line 11 def self.default @default ||= self.new end |
Instance Method Details
#exception!(*args) ⇒ Object
35 36 37 |
# File 'lib/skein/context.rb', line 35 def exception!(*args) @reporter&.exception!(*args) end |
#ident(object) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/skein/context.rb', line 23 def ident(object) # FUTURE: Add pack/unpack methods for whatever format this ends up being # so the components can be extracted by another application for # diagnostic reasons. '%s#%d+%s@%s' % [ @process_name, @process_id, object.object_id, @hostname ] end |
#trap ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/skein/context.rb', line 39 def trap yield rescue SystemExit raise rescue Object => e self.exception!(e) end |