Method: Gem::URI.extract

Defined in:
lib/rubygems/vendor/uri/lib/uri/common.rb

.extract(str, schemes = nil, &block) ⇒ Object

Synopsis

Gem::URI::extract(str[, schemes][,&blk])

Args

str

String to extract URIs from.

schemes

Limit Gem::URI matching to specific schemes.

Description

Extracts URIs from a string. If block given, iterates through all matched URIs. Returns nil if block given or array with matches.

Usage

require "rubygems/vendor/uri/lib/uri"

Gem::URI.extract("text here http://foo.example.org/bla and here mailto:test@example.com and here also.")
# => ["http://foo.example.com/bla", "mailto:test@example.com"]

262
263
264
265
# File 'lib/rubygems/vendor/uri/lib/uri/common.rb', line 262

def self.extract(str, schemes = nil, &block) # :nodoc:
  warn "Gem::URI.extract is obsolete", uplevel: 1 if $VERBOSE
  DEFAULT_PARSER.extract(str, schemes, &block)
end