Class: Flipper::Types::Percentage
- Inherits:
-
Flipper::Type
- Object
- Flipper::Type
- Flipper::Types::Percentage
- Defined in:
- lib/flipper/types/percentage.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Flipper::Type
Instance Method Summary collapse
-
#initialize(value) ⇒ Percentage
constructor
A new instance of Percentage.
Methods inherited from Flipper::Type
Constructor Details
#initialize(value) ⇒ Percentage
Returns a new instance of Percentage.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/flipper/types/percentage.rb', line 6 def initialize(value) value = Typecast.to_number(value) if value < 0 || value > 100 raise ArgumentError, "value must be a positive number less than or equal to 100, but was #{value}" end @value = value end |