Sha256: d4590bae99b72242d5184728d80e9501bf8118203548052a94e4c4e18df1c74c
Contents?: true
Size: 718 Bytes
Versions: 4
Compression:
Stored size: 718 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] # It may fail to generate an example, see bug #72. options[:regexp].gen rescue ('Failed to generate example for %s' % options[:regexp].inspect) else /\w+/.gen end end def self.family 'string' end end end
Version data entries
4 entries across 4 versions & 1 rubygems