Method: Bundler::URI::RFC2396_Parser#extract

Defined in:
lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb

#extract(str, schemes = nil) ⇒ Object

:call-seq:

extract( str )
extract( str, schemes )
extract( str, schemes ) {|item| block }

Args

str

String to 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 Bundler::URI::Parser.make_regexp.

[View source]

249
250
251
252
253
254
255
256
257
258
# File 'lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb', line 249

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