module ObjectValidator::Validator::InstanceMethods
Attributes
errors[R]
object[R]
Public Class Methods
new(object)
click to toggle source
# File lib/object_validator/validator.rb, line 11 def initialize(object) @object = object @errors = Errors.new end
Public Instance Methods
valid?()
click to toggle source
# File lib/object_validator/validator.rb, line 16 def valid? self.class.checks.each { |args| call_checks(*args) } @errors.all.empty? end
Private Instance Methods
call_checks(name, checks)
click to toggle source
# File lib/object_validator/validator.rb, line 23 def call_checks(name, checks) checks.each do |check| klass = check.first.to_s.split('_').collect(&:capitalize).join klass = Object.const_get("ObjectValidator::Checks::#{klass}") klass.new(@object, @errors, name, check.last).call end end