Sha256: b0f55ac1644e4961ec99aa730510709e1491943039cb3537c6f0bff61720aba3

Contents?: true

Size: 1.17 KB

Versions: 54

Compression:

Stored size: 1.17 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(options = {})
      @feature_name = options.fetch(:feature_name)
      @values = options.fetch(:values)
      @thing = options.fetch(: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

54 entries across 54 versions & 1 rubygems

Version Path
flipper-0.20.2 lib/flipper/feature_check_context.rb
flipper-0.20.1 lib/flipper/feature_check_context.rb
flipper-0.20.0 lib/flipper/feature_check_context.rb
flipper-0.20.0.beta3 lib/flipper/feature_check_context.rb
flipper-0.20.0.beta2 lib/flipper/feature_check_context.rb
flipper-0.20.0.beta1 lib/flipper/feature_check_context.rb
flipper-0.19.1 lib/flipper/feature_check_context.rb
flipper-0.19.0 lib/flipper/feature_check_context.rb
flipper-0.18.0 lib/flipper/feature_check_context.rb
flipper-0.17.2 lib/flipper/feature_check_context.rb
flipper-0.17.1 lib/flipper/feature_check_context.rb
flipper-0.16.2 lib/flipper/feature_check_context.rb
flipper-0.16.1 lib/flipper/feature_check_context.rb
flipper-0.16.0 lib/flipper/feature_check_context.rb
flipper-0.15.0 lib/flipper/feature_check_context.rb
flipper-0.14.0 lib/flipper/feature_check_context.rb
flipper-0.13.0 lib/flipper/feature_check_context.rb
flipper-0.13.0.beta1 lib/flipper/feature_check_context.rb
flipper-0.12.2 lib/flipper/feature_check_context.rb
flipper-0.12.1 lib/flipper/feature_check_context.rb