class Toys::Acceptor::Pattern


results.
custom conversion function that generates the final value from the match
An acceptor that uses a regex to validate input. It also supports a
#

def convert(str, *extra)

Other tags:
    Private: -
def convert(str, *extra)
  @converter ? @converter.call(str, *extra) : str
end

def initialize(regex, converter = nil, type_desc: nil, well_known_spec: nil, &block)

Parameters:
  • block (Proc) -- A converter function, if not provided as a normal
  • well_known_spec (Object) -- The well-known acceptor spec associated
  • type_desc (String) -- Type description string, shown in help.
  • converter (Proc) -- An optional converter function. May also be
  • regex (Regexp) -- Regular expression defining value values.
def initialize(regex, converter = nil, type_desc: nil, well_known_spec: nil, &block)
  super(type_desc: type_desc, well_known_spec: well_known_spec)
  @regex = regex
  @converter = converter || block
end

def match(str)

Other tags:
    Private: -
def match(str)
  str.nil? ? [nil] : @regex.match(str)
end