module ErrorProne::Validator
Mixed in to objects you wish to use to validate other objects
@example
class ObjectToValidate < Struct.new(:name) include ErrorProne::Model end class ObjectValidator include ErrorProne::Validator validates :name, :present end object = ObjectToValidate.new(nil) ObjectValidator.new.validate!(object) # false object.valid? # false object.errors_for(:name) # [:missing]
Public Class Methods
included(base)
click to toggle source
# File lib/error_prone.rb, line 161 def self.included(base) base.extend(ClassMethods) end
Public Instance Methods
validate!(object)
click to toggle source
Alias for {ErrorProne::Validator}.validate
# File lib/error_prone.rb, line 157 def validate!(object) self.class.validate!(object) end