Module: Quiver::Model::Validations
- Defined in:
- lib/quiver/model/validations.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(host) ⇒ Object
4 5 6 |
# File 'lib/quiver/model/validations.rb', line 4 def self.included(host) host.send(:extend, ClassMethods) end |
Instance Method Details
#validate(options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/quiver/model/validations.rb', line 27 def validate(={}) result = self.class.validator.validate(self, ) if respond_to?(:extant_attributes, true) extant_attributes.each do |(key, attr_object)| unless coerced?(attr_object.name) result << Quiver::Model::ValidationError.new( attr_object.name, "could_not_be_coerced_to_expected_type.#{attr_object.coercer_name}" ) end end end result end |