module Allowed::Limit

Private Instance Methods

handle_throttles() click to toggle source
# File lib/allowed/limit.rb, line 24
def handle_throttles
  @_throttle_failures.each do |throttle|
    throttle.callback.call(self)
  end
  @_throttle_failures = []
end
validate_throttles() click to toggle source
# File lib/allowed/limit.rb, line 32
def validate_throttles
  throttles = self.class._throttles
  throttles = throttles.reject { |throttle| throttle.valid?(self) }
  throttles.each do |throttle|
    errors.add(:base, throttle.message)
  end

  @_throttle_failures = throttles
end