You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: throttle.rb
    path of file: ./repos/chordbook/lib
    
    the code of the file until where you have to start completion: # Only allow a thing to happen once in the given duration
class Throttle
  def initialize(duration = 1.second)
    @duration = duration
    @mutex = Mutex.new
    @clock = Time.new(0)
  end

  def call(&block)
    @mutex.synchronize
    
  def call(&block)
    @mutex.synchronize do
      # How long do we need to wait for the next call?
      wait = @duration - (Time.now - @clock)

      # Sleep if the desired duration has not elapsed
      sleep wait if wait > 0.0

      # Reset clock for next call
      @clock = Time.now
    end

    # Have a nice day, sir
    block.call
  end
end