Sha256: 619454071735bacbdb90d98d007ccd0ed22b19f2253ecd1f59e22b1dc5af2961

Contents?: true

Size: 367 Bytes

Versions: 6

Compression:

Stored size: 367 Bytes

Contents

# frozen_string_literal: true

require 'image_optim/elapsed_time'

class ImageOptim
  # Hold start time and timeout
  class Timer
    include ElapsedTime

    def initialize(seconds)
      @start = now
      @seconds = seconds
    end

    def elapsed
      now - @start
    end

    def left
      @seconds - elapsed
    end

    alias_method :to_f, :left
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
image_optim-0.31.4 lib/image_optim/timer.rb
image_optim-0.31.3 lib/image_optim/timer.rb
image_optim-0.31.2 lib/image_optim/timer.rb
image_optim-0.31.1 lib/image_optim/timer.rb
image_optim-0.31.0 lib/image_optim/timer.rb
image_optim-0.30.0 lib/image_optim/timer.rb