Sha256: ce90e0ee9ef86e6db5c2c2799ab302ed5907b66d75fe9b2445beb7bd9ab2f669

Contents?: true

Size: 370 Bytes

Versions: 3

Compression:

Stored size: 370 Bytes

Contents

module Raterr
  class Hour

    include Mixin

    MINUTES_PER_HOUR = 60.freeze

    private

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

    def rate_period
      start_time + 3600
    end

    def try_after
      "#{MINUTES_PER_HOUR - ((Time.now - start_time) / MINUTES_PER_HOUR).ceil} minutes"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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