Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
URI::RFC2396_Parser#extract
(::String str, ?::Array[::String] schemes) -> ::Array[::String]
(::String str, ?::Array[::String] schemes) { (::String) -> untyped } -> nil
extract( str )
extract( str, schemes )
extract( str, schemes ) {|item| block }
lib/uri/rfc2396_parser.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/uri/rfc2396_parser.rb, line 248
def extract(str, schemes = nil)
if block_given?
str.scan(make_regexp(schemes)) { yield $& }
nil
else
result = []
str.scan(make_regexp(schemes)) { result.push $& }
result
end
end
Args
str-
Stringto search schemes-
Patterns to apply to
str
Description
Attempts to parse and merge a set of URIs. If no block given, then returns the result, else it calls block for each element in result.
See also make_regexp.
See also
#escape
#initialize_pattern
#convert_to_uri
#initialize_regexp
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0