Class: Rant::RantVar::Constraints::FloatInRange
- Defined in:
- lib/rant/import/var/numbers.rb
Instance Method Summary collapse
- #default ⇒ Object
- #filter(val) ⇒ Object
-
#initialize(range) ⇒ FloatInRange
constructor
A new instance of FloatInRange.
- #to_s ⇒ Object
Methods inherited from Float
Constructor Details
#initialize(range) ⇒ FloatInRange
Returns a new instance of FloatInRange.
83 84 85 |
# File 'lib/rant/import/var/numbers.rb', line 83 def initialize(range) @range = range end |
Instance Method Details
#default ⇒ Object
94 95 96 |
# File 'lib/rant/import/var/numbers.rb', line 94 def default @range.first end |
#filter(val) ⇒ Object
86 87 88 89 90 91 92 93 |
# File 'lib/rant/import/var/numbers.rb', line 86 def filter(val) i = super if @range === i i else raise ConstraintError.new(self, val) end end |
#to_s ⇒ Object
97 98 99 |
# File 'lib/rant/import/var/numbers.rb', line 97 def to_s super + " #{@range}" end |