Sha256: b7fe50cbe2ea45e37c442c98f1a3086d7155eb68ab918a6de27281cff0fb4885

Contents?: true

Size: 364 Bytes

Versions: 3

Compression:

Stored size: 364 Bytes

Contents

module Raterr
  class Day

    include Mixin

    HOURS_PER_DAY = 24.freeze

    private

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

    def rate_period
      start_time + 3600 * HOURS_PER_DAY
    end

    def try_after
      "#{HOURS_PER_DAY - ((Time.now - start_time) / 3600).ceil} hours"
    end
  end
end


Version data entries

3 entries across 3 versions & 1 rubygems

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