Class: Sail::Types::Throttle
Overview
Throttle
The Throttle type returns true X
% of the time (randomly), where X
is the value saved in the database.
Example:
If the setting value is 30, it will return true
30% of the time.
Instance Method Summary collapse
Methods inherited from Type
Constructor Details
This class inherits a constructor from Sail::Types::Type
Instance Method Details
#to_value ⇒ Object
16 17 18 |
# File 'lib/sail/types/throttle.rb', line 16 def to_value 100 * rand <= @setting.value.to_f end |