Class: RootLogger::MetaData
- Inherits:
-
Hash
- Object
- Hash
- RootLogger::MetaData
- Defined in:
- lib/unicorn-cuba-base/root_logger.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(parent = nil) ⇒ MetaData
constructor
A new instance of MetaData.
- #to_s ⇒ Object
Constructor Details
#initialize(parent = nil) ⇒ MetaData
Returns a new instance of MetaData.
49 50 51 |
# File 'lib/unicorn-cuba-base/root_logger.rb', line 49 def initialize(parent = nil) @parent = parent end |
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
53 54 55 |
# File 'lib/unicorn-cuba-base/root_logger.rb', line 53 def parent @parent end |
Instance Method Details
#to_s ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/unicorn-cuba-base/root_logger.rb', line 55 def to_s chain = [] parent = self while parent chain << parent parent = parent.parent end hash = {} chain.reverse.each do |child| hash.merge! child end "[meta #{JSON.dump(hash)}]" end |