跳至内容 跳至搜索
方法
F
L
M
N
包含的模块

属性

[R] flush_count
[RW] level

类公共方法

new(level = DEBUG)

# File activesupport/lib/active_support/log_subscriber/test_helper.rb, line 60
def initialize(level = DEBUG)
  @flush_count = 0
  @level = level
  @logged = Hash.new { |h, k| h[k] = [] }
end

实例公共方法

flush()

# File activesupport/lib/active_support/log_subscriber/test_helper.rb, line 78
def flush
  @flush_count += 1
end

logged(level)

# File activesupport/lib/active_support/log_subscriber/test_helper.rb, line 74
def logged(level)
  @logged[level].compact.map { |l| l.to_s.strip }
end

method_missing(level, message = nil)

# File activesupport/lib/active_support/log_subscriber/test_helper.rb, line 66
def method_missing(level, message = nil)
  if block_given?
    @logged[level] << yield
  else
    @logged[level] << message
  end
end