Sha256: f13f4889c122b66ea4ab984e7648e21ba51312d275e99a384eb33259393774b9

Contents?: true

Size: 314 Bytes

Versions: 10

Compression:

Stored size: 314 Bytes

Contents

module Flipper
  module Expressions
    class PercentageOfActors
      SCALING_FACTOR = 1_000

      def self.call(text, percentage, context: {})
        prefix = context[:feature_name] || ""
        Zlib.crc32("#{prefix}#{text}") % (100 * SCALING_FACTOR) < percentage * SCALING_FACTOR
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
flipper-1.3.2 lib/flipper/expressions/percentage_of_actors.rb
flipper-1.3.1 lib/flipper/expressions/percentage_of_actors.rb
flipper-1.3.0 lib/flipper/expressions/percentage_of_actors.rb
flipper-1.3.0.pre lib/flipper/expressions/percentage_of_actors.rb
flipper-1.2.2 lib/flipper/expressions/percentage_of_actors.rb
flipper-1.2.1 lib/flipper/expressions/percentage_of_actors.rb
flipper-1.2.0 lib/flipper/expressions/percentage_of_actors.rb
flipper-1.1.2 lib/flipper/expressions/percentage_of_actors.rb
flipper-1.1.1 lib/flipper/expressions/percentage_of_actors.rb
flipper-1.1.0 lib/flipper/expressions/percentage_of_actors.rb