module Rabbit::DirtyCount

Constants

TOO_DIRTY

Public Instance Methods

bit_dirty() click to toggle source
# File lib/rabbit/utils.rb, line 455
def bit_dirty
  dirty(0.01)
end
dirty(factor=0.1) click to toggle source
# File lib/rabbit/utils.rb, line 446
def dirty(factor=0.1)
  @dirty_count += TOO_DIRTY * factor
  dirtied if dirty?
end
dirty?() click to toggle source
# File lib/rabbit/utils.rb, line 442
def dirty?
  @dirty_count >= TOO_DIRTY
end
dirty_count_clean() click to toggle source
# File lib/rabbit/utils.rb, line 459
def dirty_count_clean
  @dirty_count = 0
end
very_dirty() click to toggle source
# File lib/rabbit/utils.rb, line 451
def very_dirty
  dirty(1)
end

Private Instance Methods

check_dirty() { || ... } click to toggle source
# File lib/rabbit/utils.rb, line 468
def check_dirty
  if dirty?
    dirtied
  else
    yield
  end
end
dirtied() click to toggle source
# File lib/rabbit/utils.rb, line 464
def dirtied
  dirty_count_clean
end