Sha256: 7b725861ec06c13141a9acdba2c631c09013202a39c0c21531bd86943081ece1
Contents?: true
Size: 589 Bytes
Versions: 17
Compression:
Stored size: 589 Bytes
Contents
require_relative '../exceptions' module Attributor class Regexp include Type def self.native_type ::Regexp end def self.load(value, context = Attributor::DEFAULT_ROOT_CONTEXT, **options) unless value.is_a?(::String) || value.nil? raise IncompatibleTypeError, context: context, value_type: value.class, type: self end value && ::Regexp.new(value) rescue super end def self.example(_context = nil, options: {}) ::Regexp.new(/^pattern\d{0,3}$/).to_s end def self.family 'string' end end end
Version data entries
17 entries across 17 versions & 1 rubygems