Class: Featureflow::Evaluate
- Inherits:
-
Object
- Object
- Featureflow::Evaluate
- Defined in:
- lib/featureflow/evaluate.rb
Instance Method Summary collapse
-
#initialize(feature_key, feature, failover_variant, context, salt, events_client = nil) ⇒ Evaluate
constructor
A new instance of Evaluate.
- #is?(value) ⇒ Boolean
- #off? ⇒ Boolean (also: #is_off?)
- #on? ⇒ Boolean (also: #is_on?)
- #value ⇒ Object
Constructor Details
#initialize(feature_key, feature, failover_variant, context, salt, events_client = nil) ⇒ Evaluate
Returns a new instance of Evaluate.
5 6 7 8 9 10 |
# File 'lib/featureflow/evaluate.rb', line 5 def initialize(feature_key, feature, failover_variant, context, salt, events_client = nil) @evaluated_variant = calculate_variant feature_key, feature, failover_variant, context, salt @events_client = events_client @context = context @key = feature_key end |
Instance Method Details
#is?(value) ⇒ Boolean
12 13 14 15 |
# File 'lib/featureflow/evaluate.rb', line 12 def is?(value) @events_client.evaluate @key, @evaluated_variant, value, @context unless @events_client.is_a?(NilClass) @evaluated_variant == value end |
#off? ⇒ Boolean Also known as: is_off?
22 23 24 |
# File 'lib/featureflow/evaluate.rb', line 22 def off? is? 'off' end |
#on? ⇒ Boolean Also known as: is_on?
17 18 19 |
# File 'lib/featureflow/evaluate.rb', line 17 def on? is? 'on' end |
#value ⇒ Object
27 28 29 |
# File 'lib/featureflow/evaluate.rb', line 27 def value @evaluated_variant end |