Class: Burner::Modeling::Validations::Blank
- Defined in:
- lib/burner/modeling/validations/blank.rb
Overview
Check if a value is blank, if it is not blank then it is not valid.
Direct Known Subclasses
Constant Summary collapse
- BLANK_RE =
/\A[[:space:]]*\z/.freeze
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Burner::Modeling::Validations::Base
Instance Method Details
#valid?(object, resolver) ⇒ Boolean
21 22 23 24 25 |
# File 'lib/burner/modeling/validations/blank.rb', line 21 def valid?(object, resolver) value = resolver.get(object, key).to_s value.empty? || BLANK_RE.match?(value) end |