Parent

Methods

Files

ProgressBar::Components::Throttle

Public Class Methods

new(options = {}) click to toggle source
# File lib/ruby-progressbar/components/throttle.rb, line 6
def initialize(options = {})
  @period = options.delete(:throttle_rate) { 0.01 } || 0.01
end

Public Instance Methods

choke(force = false, &block) click to toggle source
# File lib/ruby-progressbar/components/throttle.rb, line 10
def choke(force = false, &block)
  if !started? || @period.nil? || force || elapsed_seconds >= @period
    yield

    start
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.