Sha256: 590494c438264325a8c5f91094946d76c07a14bd6cd0b0329989d68bbc304a80
Contents?: true
Size: 788 Bytes
Versions: 5
Compression:
Stored size: 788 Bytes
Contents
module Attributor class String include Type def self.native_type return ::String end def self.load(value,context=Attributor::DEFAULT_ROOT_CONTEXT, **options) if value.kind_of?(Enumerable) raise IncompatibleTypeError, context: context, value_type: value.class, type: self end value && String(value) rescue super end def self.example(context=nil, options:{}) if options[:regexp] begin # It may fail to generate an example, see bug #72. options[:regexp].gen rescue => e 'Failed to generate example for %s : %s' % [ options[:regexp].inspect, e.message] end else /\w+/.gen end end def self.family 'string' end end end
Version data entries
5 entries across 5 versions & 1 rubygems