Module: EzValidate
- Defined in:
- lib/ez_validate.rb,
lib/ez_validate/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
Instance Method Details
#blank_fields? ⇒ Boolean
6 7 8 |
# File 'lib/ez_validate.rb', line 6 def blank_fields? attributes.values.map(&:strip).include?('') end |
#valid? ⇒ Boolean
10 11 12 13 14 15 16 17 |
# File 'lib/ez_validate.rb', line 10 def valid? return true unless blank_fields? attributes.map do |key, value| errors << "#{key}: não pode ficar em branco!" if value.strip.empty? end false end |