Class: ActiveSupport::TaggedLogging::TagStack
- Defined in:
- activesupport/lib/active_support/tagged_logging.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #clear ⇒ Object
- #format_message(message) ⇒ Object
-
#initialize ⇒ TagStack
constructor
A new instance of TagStack.
- #pop_tags(count) ⇒ Object
- #push_tags(tags) ⇒ Object
Constructor Details
#initialize ⇒ TagStack
Returns a new instance of TagStack.
74 75 76 77 |
# File 'activesupport/lib/active_support/tagged_logging.rb', line 74 def initialize @tags = [] @tags_string = nil end |
Instance Attribute Details
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
72 73 74 |
# File 'activesupport/lib/active_support/tagged_logging.rb', line 72 def @tags end |
Instance Method Details
#clear ⇒ Object
92 93 94 95 |
# File 'activesupport/lib/active_support/tagged_logging.rb', line 92 def clear @tags_string = nil @tags.clear end |
#format_message(message) ⇒ Object
97 98 99 100 101 102 103 104 105 106 |
# File 'activesupport/lib/active_support/tagged_logging.rb', line 97 def () if @tags.empty? elsif @tags.size == 1 "[#{@tags[0]}] #{}" else @tags_string ||= "[#{@tags.join("] [")}] " "#{@tags_string}#{}" end end |
#pop_tags(count) ⇒ Object
87 88 89 90 |
# File 'activesupport/lib/active_support/tagged_logging.rb', line 87 def (count) @tags_string = nil @tags.pop(count) end |
#push_tags(tags) ⇒ Object
79 80 81 82 83 84 85 |
# File 'activesupport/lib/active_support/tagged_logging.rb', line 79 def () @tags_string = nil .flatten! .reject!(&:blank?) @tags.concat() end |