lib/traffic_jam/lifetime_limit.rb
# Increment the amount used by the given number. Does not perform increment
# if the operation would exceed the limit. Returns whether the operation was
# successful.
#
# @param amount [Integer] amount to increment by
# @return [Boolean] true if increment succeded and false if incrementing
#   would exceed the limit
Increment the amount used by the given number. Does not perform increment
if the operation would exceed the limit. Returns whether the operation was
successful.
Increment the amount used by the given number . Does not perform increment if the operation would exceed the limit . Returns whether the operation was successful .
def increment(amount = 1, time: Time.now)
      raise ArgumentError, 'Amount must be an integer' if amount != amount.to_i
      return amount <= 0 if max.zero?
      !!run_script([amount.to_i, max])
    end
def increment ( amount = 1 , time : Time . now ) raise ArgumentError , 'Amount must be an integer' if amount != amount . to_i return amount <= 0 if max . zero? ! ! run_script ( [ amount . to_i , max ] ) end
Increment the amount used by the given number.
Increment the amount used by the given number .
true if increment succeded and false if incrementing would exceed the limit
true if increment succeded and false if incrementing would exceed the limit
Boolean
amount
amount to increment by
amount to increment by
time
<not_specific>
now
<not_specific>