123456789_123456789_123456789_123456789_123456789_

Class: ActiveSupport::TaggedLogging::TagStack

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: activesupport/lib/active_support/tagged_logging.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.newTagStack

[ GitHub ]

  
# File 'activesupport/lib/active_support/tagged_logging.rb', line 73

def initialize
  @tags = []
  @tags_string = nil
end

Instance Attribute Details

#tags (readonly)

[ GitHub ]

  
# File 'activesupport/lib/active_support/tagged_logging.rb', line 71

attr_reader :tags

Instance Method Details

#clear

[ GitHub ]

  
# File 'activesupport/lib/active_support/tagged_logging.rb', line 91

def clear
  @tags_string = nil
  @tags.clear
end

#format_message(message)

[ GitHub ]

  
# File 'activesupport/lib/active_support/tagged_logging.rb', line 96

def format_message(message)
  if @tags.empty?
    message
  elsif @tags.size == 1
    "[#{@tags[0]}] #{message}"
  else
    @tags_string ||= "[#{@tags.join("] [")}] "
    "#{@tags_string}#{message}"
  end
end

#pop_tags(count)

[ GitHub ]

  
# File 'activesupport/lib/active_support/tagged_logging.rb', line 86

def pop_tags(count)
  @tags_string = nil
  @tags.pop(count)
end

#push_tags(tags)

[ GitHub ]

  
# File 'activesupport/lib/active_support/tagged_logging.rb', line 78

def push_tags(tags)
  @tags_string = nil
  tags.flatten!
  tags.reject!(&:blank?)
  @tags.concat(tags)
  tags
end