Sha256: a0cf085ccabb21f89dba8b079b01d15e010b8e5e238bc2f4329d5f9cd9ced741

Contents?: true

Size: 374 Bytes

Versions: 3

Compression:

Stored size: 374 Bytes

Contents

module Raterr
  class Minute

    include Mixin

    SECONDS_PER_MINUTE = 60.freeze

    private

    def max_per_minutes
      options[:max]
    end
    alias_method :max_per_period, :max_per_minutes

    def rate_period
      start_time + SECONDS_PER_MINUTE
    end

    def try_after
      "#{SECONDS_PER_MINUTE - (Time.now - start_time).ceil} seconds"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
raterr-0.1.2 lib/raterr/minute.rb
raterr-0.1.1 lib/raterr/minute.rb
raterr-0.1.0 lib/raterr/minute.rb