Sha256: fd8f4adaf54969db320c65ee7ecb3ea4944d578aee2b84affa12a98f25d2f3e6

Contents?: true

Size: 1.21 KB

Versions: 16

Compression:

Stored size: 1.21 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 actors we want to know if a feature is enabled for.
    attr_reader :actors

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

    def actors?
      !@actors.nil? && !@actors.empty?
    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

16 entries across 16 versions & 1 rubygems

Version Path
flipper-1.3.2 lib/flipper/feature_check_context.rb
flipper-1.3.1 lib/flipper/feature_check_context.rb
flipper-1.3.0 lib/flipper/feature_check_context.rb
flipper-1.3.0.pre lib/flipper/feature_check_context.rb
flipper-1.2.2 lib/flipper/feature_check_context.rb
flipper-1.2.1 lib/flipper/feature_check_context.rb
flipper-1.2.0 lib/flipper/feature_check_context.rb
flipper-1.1.2 lib/flipper/feature_check_context.rb
flipper-1.1.1 lib/flipper/feature_check_context.rb
flipper-1.1.0 lib/flipper/feature_check_context.rb
flipper-1.0.0 lib/flipper/feature_check_context.rb
flipper-1.0.0.pre lib/flipper/feature_check_context.rb
flipper-0.28.3 lib/flipper/feature_check_context.rb
flipper-0.28.2 lib/flipper/feature_check_context.rb
flipper-0.28.1 lib/flipper/feature_check_context.rb
flipper-0.28.0 lib/flipper/feature_check_context.rb