Class: Flipper::Expressions::PercentageOfActors

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

Constant Summary collapse

SCALING_FACTOR =
1_000

Class Method Summary collapse

Class Method Details

.call(text, percentage, context: {}) ⇒ Object



6
7
8
9
# File 'lib/flipper/expressions/percentage_of_actors.rb', line 6

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