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 74

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

Instance Attribute Details

#tags (readonly)

[ GitHub ]

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

attr_reader :tags

Instance Method Details

#clear

[ GitHub ]

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

def clear
  @tags_string = nil
  @tags.clear
end

#format_message(message)

[ GitHub ]

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

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 87

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

#push_tags(tags)

[ GitHub ]

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

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