class Regexp
def if_match(string, required = true, &block) # rubocop:disable Style/OptionalBooleanParameter
+nil+ otherwise.
If +self+ does not match +string+ raises a +ArgumentError+ if +required+ is truthy or return
not provided.
If +self+ matches +string+ returns +block.call(Match result) or only Match result if block is
def if_match(string, required = true, &block) # rubocop:disable Style/OptionalBooleanParameter m = match(string) if m block ? block.call(m) : m elsif required raise(::ArgumentError, "Pattern \"#{self}\" does not match string \"#{string}\"") end end
def to_parser(&block)
-
(::EacRubyUtils::RegexpParser)
-
def to_parser(&block) ::EacRubyUtils::RegexpParser.new(self, &block) end