class Attributor::Regexp
Public Class Methods
example(_context = nil, options: {})
click to toggle source
# File lib/attributor/types/regexp.rb, line 21 def self.example(_context = nil, options: {}) ::Regexp.new(/^pattern\d{0,3}$/).to_s end
family()
click to toggle source
# File lib/attributor/types/regexp.rb, line 25 def self.family 'string' end
load(value, context = Attributor::DEFAULT_ROOT_CONTEXT, **options)
click to toggle source
Calls superclass method
# File lib/attributor/types/regexp.rb, line 11 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
native_type()
click to toggle source
# File lib/attributor/types/regexp.rb, line 7 def self.native_type ::Regexp end