Class: Flipper::FeatureCheckContext
- Inherits:
-
Object
- Object
- Flipper::FeatureCheckContext
- Defined in:
- lib/flipper/feature_check_context.rb
Instance Attribute Summary collapse
-
#actors ⇒ Object
readonly
Public: The actors we want to know if a feature is enabled for.
-
#feature_name ⇒ Object
readonly
Public: The name of the feature.
-
#values ⇒ Object
readonly
Public: The GateValues instance that keeps track of the values for the gates for the feature.
Instance Method Summary collapse
- #actors? ⇒ Boolean
-
#actors_value ⇒ Object
Public: Convenience method for actors value value like Feature has.
-
#boolean_value ⇒ Object
Public: Convenience method for boolean value value like Feature has.
-
#groups_value ⇒ Object
Public: Convenience method for groups value like Feature has.
-
#initialize(feature_name:, values:, actors:) ⇒ FeatureCheckContext
constructor
A new instance of FeatureCheckContext.
-
#percentage_of_actors_value ⇒ Object
Public: Convenience method for percentage of actors value like Feature has.
-
#percentage_of_time_value ⇒ Object
Public: Convenience method for percentage of time value like Feature has.
Constructor Details
#initialize(feature_name:, values:, actors:) ⇒ FeatureCheckContext
Returns a new instance of FeatureCheckContext.
13 14 15 16 17 |
# File 'lib/flipper/feature_check_context.rb', line 13 def initialize(feature_name:, values:, actors:) @feature_name = feature_name @values = values @actors = actors end |
Instance Attribute Details
#actors ⇒ Object (readonly)
Public: The actors we want to know if a feature is enabled for.
11 12 13 |
# File 'lib/flipper/feature_check_context.rb', line 11 def actors @actors end |
#feature_name ⇒ Object (readonly)
Public: The name of the feature.
4 5 6 |
# File 'lib/flipper/feature_check_context.rb', line 4 def feature_name @feature_name end |
#values ⇒ Object (readonly)
Public: The GateValues instance that keeps track of the values for the gates for the feature.
8 9 10 |
# File 'lib/flipper/feature_check_context.rb', line 8 def values @values end |
Instance Method Details
#actors? ⇒ Boolean
19 20 21 |
# File 'lib/flipper/feature_check_context.rb', line 19 def actors? !@actors.nil? && !@actors.empty? end |
#actors_value ⇒ Object
Public: Convenience method for actors value value like Feature has.
29 30 31 |
# File 'lib/flipper/feature_check_context.rb', line 29 def actors_value values.actors end |
#boolean_value ⇒ Object
Public: Convenience method for boolean value value like Feature has.
34 35 36 |
# File 'lib/flipper/feature_check_context.rb', line 34 def boolean_value values.boolean end |
#groups_value ⇒ Object
Public: Convenience method for groups value like Feature has.
24 25 26 |
# File 'lib/flipper/feature_check_context.rb', line 24 def groups_value values.groups end |
#percentage_of_actors_value ⇒ Object
Public: Convenience method for percentage of actors value like Feature has.
39 40 41 |
# File 'lib/flipper/feature_check_context.rb', line 39 def percentage_of_actors_value values.percentage_of_actors end |
#percentage_of_time_value ⇒ Object
Public: Convenience method for percentage of time value like Feature has.
44 45 46 |
# File 'lib/flipper/feature_check_context.rb', line 44 def percentage_of_time_value values.percentage_of_time end |