Sha256: 253f4c474a3fd0d099d04907268a61f5885e303cf0b116c2e80bf2df1909b7bf
Contents?: true
Size: 774 Bytes
Versions: 3
Compression:
Stored size: 774 Bytes
Contents
require 'data_mapper/types/base' module DataMapper module Types class String < ::String include Types::Base TYPE_MAP[:string] = self TYPE_MAP[::String] = self def self.length length_validator end def self.matches(regexp) match_validator.matches(regexp) end def self.length_validator @length_validator || @length_validator = Validations::NumberValidator.new end def self.match_validator @match_validator || @match_validator = Validations::StringValidator.new end def do_validations errors.concat(self.class.length_validator.errors_for(length)) errors.concat(self.class.match_validator.errors_for(self)) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
datamapper-0.3.1 | lib/data_mapper/types/string.rb |
datamapper-0.3.0 | lib/data_mapper/types/string.rb |
datamapper-0.3.2 | lib/data_mapper/types/string.rb |