Class: CLIUtils::NumberValidator
- Inherits:
-
PrefValidator
- Object
- PrefValidator
- CLIUtils::NumberValidator
- Defined in:
- lib/cliutils/prefs/pref_validators/number_validator.rb
Overview
A Validator to verify whether a Pref answer is not a number.
Instance Attribute Summary
Attributes inherited from PrefValidator
Instance Method Summary collapse
-
#validate(text) ⇒ String
Runs the Validator against the answer.
Methods included from Messaging
Instance Method Details
#validate(text) ⇒ String
Runs the Validator against the answer.
8 9 10 11 |
# File 'lib/cliutils/prefs/pref_validators/number_validator.rb', line 8 def validate(text) @is_valid = text.to_s =~ /\A[-+]?\d*\.?\d+\z/ = "Response is not a number: #{ text }" end |