module Quiver::Model::Validations

Public Class Methods

included(host) click to toggle source
# File lib/quiver/model/validations.rb, line 4
def self.included(host)
  host.send(:extend, ClassMethods)
end

Public Instance Methods

validate(options={}) click to toggle source
# File lib/quiver/model/validations.rb, line 27
def validate(options={})
  result = self.class.validator.validate(self, options)

  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