Sha256: 9f063ab39cd15acef47ba9745aeaaae3c5cda43062d4331b9e23e9ed7363cff2

Contents?: true

Size: 364 Bytes

Versions: 1

Compression:

Stored size: 364 Bytes

Contents

module ObjectValidator
  module Validate
    def valid?
      @validator = validator_klass.new(self)
      @validator.valid?
    end

    def errors
      return Errors.new unless defined?(@validator)
      @validator.errors
    end

    private

    def validator_klass
      @validator_klass ||= Object.const_get("#{self.class.name}Validator")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
object_validator-0.1.0 lib/object_validator/validate.rb