Sha256: c23834f62781504541ad0f3b097463c29c767fc645011e355720597bdafa1f2b

Contents?: true

Size: 350 Bytes

Versions: 35

Compression:

Stored size: 350 Bytes

Contents

require "forwardable"

module Ddr::Models
  module Validatable

    def self.included(base)
      base.extend Forwardable
      base.def_delegators :validator, :valid?, :invalid?, :errors

      class << base
        attr_accessor :validator
      end
    end

    def validator
      @validator ||= self.class.validator.new(self)
    end

  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
ddr-models-3.0.8 lib/ddr/models/validatable.rb
ddr-models-3.0.7 lib/ddr/models/validatable.rb
ddr-models-3.0.6 lib/ddr/models/validatable.rb
ddr-models-3.0.5 lib/ddr/models/validatable.rb
ddr-models-3.0.4 lib/ddr/models/validatable.rb
ddr-models-3.0.3 lib/ddr/models/validatable.rb
ddr-models-3.0.2 lib/ddr/models/validatable.rb
ddr-models-3.0.1 lib/ddr/models/validatable.rb
ddr-models-3.0.0 lib/ddr/models/validatable.rb
ddr-models-3.0.0.rc6 lib/ddr/models/validatable.rb
ddr-models-3.0.0.rc5 lib/ddr/models/validatable.rb
ddr-models-3.0.0.rc4 lib/ddr/models/validatable.rb
ddr-models-3.0.0.rc3 lib/ddr/models/validatable.rb
ddr-models-3.0.0.rc2 lib/ddr/models/validatable.rb
ddr-models-3.0.0.rc1 lib/ddr/models/validatable.rb
ddr-models-3.0.0.beta.22 lib/ddr/models/validatable.rb
ddr-models-3.0.0.beta.21 lib/ddr/models/validatable.rb
ddr-models-3.0.0.beta.20 lib/ddr/models/validatable.rb
ddr-models-3.0.0.beta.18 lib/ddr/models/validatable.rb
ddr-models-3.0.0.beta.17 lib/ddr/models/validatable.rb