Class: Hermod::Validators::Range
- Defined in:
- lib/hermod/validators/range.rb
Overview
Checks a value is in the given range
Instance Attribute Summary collapse
-
#range ⇒ Object
readonly
Returns the value of attribute range.
Instance Method Summary collapse
-
#initialize(range_or_min, max = nil) ⇒ Range
constructor
A new instance of Range.
Methods inherited from Base
Constructor Details
#initialize(range_or_min, max = nil) ⇒ Range
Returns a new instance of Range.
9 10 11 12 13 14 15 |
# File 'lib/hermod/validators/range.rb', line 9 def initialize(range_or_min, max = nil) if max @range = range_or_min..max else @range = range_or_min end end |
Instance Attribute Details
#range ⇒ Object (readonly)
Returns the value of attribute range.
7 8 9 |
# File 'lib/hermod/validators/range.rb', line 7 def range @range end |