Class: Flipper::Adapters::ActorLimit
- Defined in:
- lib/flipper/adapters/actor_limit.rb
Constant Summary collapse
Constants inherited from Wrapper
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
Attributes inherited from Wrapper
Instance Method Summary collapse
- #enable(feature, gate, resource) ⇒ Object
-
#initialize(adapter, limit = 100) ⇒ ActorLimit
constructor
A new instance of ActorLimit.
Methods inherited from Wrapper
Methods included from Flipper::Adapter
#default_config, #export, #get_all, #get_multi, #import, included, #name, #read_only?
Constructor Details
#initialize(adapter, limit = 100) ⇒ ActorLimit
Returns a new instance of ActorLimit.
8 9 10 11 |
# File 'lib/flipper/adapters/actor_limit.rb', line 8 def initialize(adapter, limit = 100) super(adapter) @limit = limit end |
Instance Attribute Details
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
6 7 8 |
# File 'lib/flipper/adapters/actor_limit.rb', line 6 def limit @limit end |
Instance Method Details
#enable(feature, gate, resource) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/flipper/adapters/actor_limit.rb', line 13 def enable(feature, gate, resource) if gate.is_a?(Flipper::Gates::Actor) && over_limit?(feature) raise LimitExceeded, "Actor limit of #{@limit} exceeded for feature #{feature.key}. See https://www.flippercloud.io/docs/features/actors#limitations" else super end end |