Class: Flipper::Gates::PercentageOfRandom
Constant Summary
collapse
- Key =
:perc_time
Flipper::Gate::Separator
Instance Attribute Summary
#feature
Instance Method Summary
collapse
#disable, #enable, #initialize, #key, #key_prefix, #match?, #toggle, #toggle_class
Constructor Details
This class inherits a constructor from Flipper::Gate
Instance Method Details
#open?(actor) ⇒ Boolean
10
11
12
13
14
15
16
17
18
|
# File 'lib/flipper/gates/percentage_of_random.rb', line 10
def open?(actor)
percentage = toggle.value
if percentage.nil?
false
else
rand < (percentage / 100.0)
end
end
|
#type_key ⇒ Object
6
7
8
|
# File 'lib/flipper/gates/percentage_of_random.rb', line 6
def type_key
Key
end
|