Sha256: bbf6f562b0e7e30c3d78b00c48753e60882104eb161b0500d5d80f4207788fb3

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

module Flipper
  class FeatureCheckContext
    # Public: The name of the feature.
    attr_reader :feature_name

    # Public: The GateValues instance that keeps track of the values for the
    # gates for the feature.
    attr_reader :values

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

    def initialize(feature_name:, values:, thing:)
      @feature_name = feature_name
      @values = values
      @thing = thing
    end

    # Public: Convenience method for groups value like Feature has.
    def groups_value
      values.groups
    end

    # Public: Convenience method for actors value value like Feature has.
    def actors_value
      values.actors
    end

    # Public: Convenience method for boolean value value like Feature has.
    def boolean_value
      values.boolean
    end

    # Public: Convenience method for percentage of actors value like Feature has.
    def percentage_of_actors_value
      values.percentage_of_actors
    end

    # Public: Convenience method for percentage of time value like Feature has.
    def percentage_of_time_value
      values.percentage_of_time
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flipper-0.27.1 lib/flipper/feature_check_context.rb
flipper-0.27.0 lib/flipper/feature_check_context.rb
flipper-0.26.2 lib/flipper/feature_check_context.rb
flipper-0.26.1 lib/flipper/feature_check_context.rb