Class: Kharon::CoolValidator
- Defined in:
- lib/cool_validator.rb
Overview
This validator is really cooler than the other one. It will help you validate datas without raising exception, if you don't want to.
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
An array of strings, each string representing an error occured while validating the hash.
Attributes inherited from Validator
Instance Method Summary collapse
-
#has_errors? ⇒ Boolean
Fancy method to see if the validator have seen an error in the given hash.
-
#initialize(datas) ⇒ CoolValidator
constructor
Constructor of the classe, receiving the datas to validate and filter.
Methods inherited from Validator
#any, #array, #boolean, #date, #datetime, #hash, #integer, #numeric, #ssid, #text
Constructor Details
#initialize(datas) ⇒ CoolValidator
Constructor of the classe, receiving the datas to validate and filter.
16 17 18 19 |
# File 'lib/cool_validator.rb', line 16 def initialize(datas) super(datas) @errors = Array.new end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns an array of strings, each string representing an error occured while validating the hash.
|
|
# File 'lib/cool_validator.rb', line 8
|
Instance Method Details
#has_errors? ⇒ Boolean
Fancy method to see if the validator have seen an error in the given hash.
22 23 24 |
# File 'lib/cool_validator.rb', line 22 def has_errors? return (@errors.empty? ? false : true) end |