Module: ChipmunkValidatable

Included in:
ChipmunkBagValidator
Defined in:
lib/chipmunk_validatable.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


5
6
7
# File 'lib/chipmunk_validatable.rb', line 5

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)

30
31
32
33
34
# File 'lib/chipmunk_validatable.rb', line 30

def valid?
  self.class.validators.reduce(true) do |result, validator|
    result && instance_exec(&validator)
  end
end