class Infobar::Frequency
def call(&block)
def call(&block) now = Time.now if !@update || now - @update > @duration update now: now block.call end end
def initialize(duration)
def initialize(duration) @duration = duration.to_f @called = 0 end
def reset
def reset @update = nil @called = 0 self end
def to_s
def to_s @duration.to_s end
def update(now: Time.now)
def update(now: Time.now) @update = now @called += 1 end