Class: Rulix::Validators::NumberValidator
- Inherits:
-
Object
- Object
- Rulix::Validators::NumberValidator
- Defined in:
- lib/rulix/validators/number_validator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.to_proc ⇒ Object
4 5 6 |
# File 'lib/rulix/validators/number_validator.rb', line 4 def self.to_proc new.method(:call) end |
Instance Method Details
#call(value) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rulix/validators/number_validator.rb', line 8 def call value return [false, ] unless value case value when Integer, Float, Bignum, Fixnum true when String /\A[+-]?\d+\.?\d+?\Z/ === value || [false, ] else [false, ] end end |
#error_message ⇒ Object
21 22 23 |
# File 'lib/rulix/validators/number_validator.rb', line 21 def "is not a number" end |