Module: RubySmart::SimpleLogger::Extensions::Processed::InstanceMethods

Defined in:
lib/ruby_smart/simple_logger/extensions/processed.rb

Instance Method Summary collapse

Instance Method Details

#processed?Boolean

returns true if the processed state is active.

Returns:

  • (Boolean)


62
63
64
# File 'lib/ruby_smart/simple_logger/extensions/processed.rb', line 62

def processed?
  processed_lvl >= 0 && !@ignore_processed
end

#processed_lvl(handle = nil) ⇒ Integer

returns the current processed level. by providing a handle it will either increase or decrease the current level.

Parameters:

  • handle (Symbol|Integer) (defaults to: nil)
    • optional handle to increase or decrease the current lvl (+:up+ / +:down+)

Returns:

  • (Integer)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/ruby_smart/simple_logger/extensions/processed.rb', line 43

def processed_lvl(handle = nil)
  @processed_lvl ||= -1

  case handle
  when :reset
    @processed_lvl = -1
  when :up
    @processed_lvl += 1
  when :down
    @processed_lvl -= 1 if @processed_lvl >= 0
  else
    @processed_lvl = handle if handle.is_a?(Integer)
  end

  @processed_lvl
end