Class: Dropmire::Validator
- Inherits:
-
Object
- Object
- Dropmire::Validator
- Defined in:
- lib/dropmire/validator.rb
Instance Method Summary collapse
-
#initialize(text) ⇒ Validator
constructor
A new instance of Validator.
- #regex ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize(text) ⇒ Validator
Returns a new instance of Validator.
5 6 7 8 |
# File 'lib/dropmire/validator.rb', line 5 def initialize(text) @text = text validate end |
Instance Method Details
#regex ⇒ Object
16 17 18 |
# File 'lib/dropmire/validator.rb', line 16 def regex /%\w*\^\w*\$\w*\$\w*\^[\w\s]*\^\s*\?;\d*=\d*=\?\+\!\s*\d*[\s\w]*\?/ end |
#validate ⇒ Object
10 11 12 13 14 |
# File 'lib/dropmire/validator.rb', line 10 def validate if regex.match(@text).to_s == "" raise ParseError.new("Malformed input string", @text) end end |