Module: Ddr::Models::Validatable

Included in:
Auth::Roles::Role
Defined in:
lib/ddr/models/validatable.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/ddr/models/validatable.rb', line 6

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

  class << base
    attr_accessor :validator
  end
end

Instance Method Details

#validatorObject



15
16
17
# File 'lib/ddr/models/validatable.rb', line 15

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