Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
URI::Generic#select
(*::Symbol components) -> ::Array[nil | ::String | ::Integer]
select(*components)
lib/uri/generic.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/uri/generic.rb, line 1456
def select(*components)
components.collect do |c|
if component.include?(c)
self.__send__(c)
else
raise ArgumentError,
"expected of components of #{self.class} (#{self.class.component.join(', ')})"
end
end
end
Args
Description
Selects specified components from URI.
Usage
Example
require 'uri' uri = URI.parse('http://myuser:[email protected]/test.rbx') uri.select(:userinfo, :host, :path) # => ["myuser:mypass", "my.example.com", "/test.rbx"]