Class: Flipper::FeatureCheckContext

Inherits:
Object
  • Object
show all
Defined in:
lib/flipper/feature_check_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ FeatureCheckContext

Returns a new instance of FeatureCheckContext.



13
14
15
16
17
# File 'lib/flipper/feature_check_context.rb', line 13

def initialize(options = {})
  @feature_name = options.fetch(:feature_name)
  @values = options.fetch(:values)
  @thing = options.fetch(:thing)
end

Instance Attribute Details

#feature_nameObject (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

#thingObject (readonly)

Public: The thing we want to know if a feature is enabled for.



11
12
13
# File 'lib/flipper/feature_check_context.rb', line 11

def thing
  @thing
end

#valuesObject (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_valueObject

Public: Convenience method for actors value value like Feature has.



25
26
27
# File 'lib/flipper/feature_check_context.rb', line 25

def actors_value
  values.actors
end

#boolean_valueObject

Public: Convenience method for boolean value value like Feature has.



30
31
32
# File 'lib/flipper/feature_check_context.rb', line 30

def boolean_value
  values.boolean
end

#groups_valueObject

Public: Convenience method for groups value like Feature has.



20
21
22
# File 'lib/flipper/feature_check_context.rb', line 20

def groups_value
  values.groups
end

#percentage_of_actors_valueObject

Public: Convenience method for percentage of actors value like Feature has.



35
36
37
# File 'lib/flipper/feature_check_context.rb', line 35

def percentage_of_actors_value
  values.percentage_of_actors
end

#percentage_of_time_valueObject

Public: Convenience method for percentage of time value like Feature has.



40
41
42
# File 'lib/flipper/feature_check_context.rb', line 40

def percentage_of_time_value
  values.percentage_of_time
end