Sha256: a6563df5934d70d7b1cd7d080b352670214a7afccad94b431410dc67a863d736
Contents?: true
Size: 1.57 KB
Versions: 1
Compression:
Stored size: 1.57 KB
Contents
require 'super_model/validations/acceptance' require 'super_model/validations/confirmation' require 'super_model/validations/date' require 'super_model/validations/date_time' require 'super_model/validations/exclusion' require 'super_model/validations/format' require 'super_model/validations/inclusion' require 'super_model/validations/length' require 'super_model/validations/numericality' require 'super_model/validations/presence' require 'super_model/validations/time' require 'super_model/validations/uniqueness' class SuperModel module Validations class << self def validators @validators ||= [] end def register(validator_class) validators << validator_class unless validators.include?(validator_class) end def add_validations(receiver) receiver.extend(Acceptance::ClassMethods) receiver.extend(Confirmation::ClassMethods) receiver.extend(Date::ClassMethods) receiver.extend(DateTime::ClassMethods) receiver.extend(Exclusion::ClassMethods) receiver.extend(Format::ClassMethods) receiver.extend(Inclusion::ClassMethods) receiver.extend(Length::ClassMethods) receiver.extend(Numericality::ClassMethods) receiver.extend(Presence::ClassMethods) receiver.extend(Time::ClassMethods) receiver.extend(Uniqueness::ClassMethods) end def included(receiver) add_validations(receiver) end def extended(receiver) add_validations(receiver) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
super_model-0.0.1 | lib/super_model/validations.rb |