Module: ActionController::BetterRateLimit::ClassMethods
- Defined in:
- lib/action_controller/better_rate_limit.rb
Instance Method Summary collapse
Instance Method Details
#all_rate_limits ⇒ Object
30 31 32 33 34 |
# File 'lib/action_controller/better_rate_limit.rb', line 30 def all_rate_limits return rate_limits unless superclass.respond_to? :all_rate_limits rate_limits + superclass.all_rate_limits end |
#rate_limit(max, options) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/action_controller/better_rate_limit.rb', line 10 def rate_limit(max, ) rate_limits << Limit.build(max, controller_path, { if: [:if], unless: [:unless], every: [:every], name: [:name] || controller_path, scope: [:scope] || -> { real_ip }, only: [:only] || [], except: [:except] || [], clear_if: [:clear_if] }) before_action :perform_rate_limiting after_action :clear_keys end |
#rate_limits ⇒ Object
26 27 28 |
# File 'lib/action_controller/better_rate_limit.rb', line 26 def rate_limits @rate_limits ||= [] end |