module Gem

Constants

Net
Timeout
URI

Bundler::URI is a module providing classes to handle Uniform Resource Identifiers (RFC2396).

Features

  • Uniform way of handling URIs.

  • Flexibility to introduce custom Bundler::URI schemes.

  • Flexibility to have an alternate Bundler::URI::Parser (or just different patterns and regexp’s).

Basic example

require 'bundler/vendor/uri/lib/uri'

uri = Bundler::URI("http://foo.com/posts?id=30&limit=5#time=1305298413")
#=> #<Bundler::URI::HTTP http://foo.com/posts?id=30&limit=5#time=1305298413>

uri.scheme    #=> "http"
uri.host      #=> "foo.com"
uri.path      #=> "/posts"
uri.query     #=> "id=30&limit=5"
uri.fragment  #=> "time=1305298413"

uri.to_s      #=> "http://foo.com/posts?id=30&limit=5#time=1305298413"

Adding custom URIs

module Bundler::URI
  class RSYNC < Generic
    DEFAULT_PORT = 873
  end
  register_scheme 'RSYNC', RSYNC
end
#=> Bundler::URI::RSYNC

Bundler::URI.scheme_list
#=> {"FILE"=>Bundler::URI::File, "FTP"=>Bundler::URI::FTP, "HTTP"=>Bundler::URI::HTTP,
#    "HTTPS"=>Bundler::URI::HTTPS, "LDAP"=>Bundler::URI::LDAP, "LDAPS"=>Bundler::URI::LDAPS,
#    "MAILTO"=>Bundler::URI::MailTo, "RSYNC"=>Bundler::URI::RSYNC}

uri = Bundler::URI("rsync://rsync.foo.com")
#=> #<Bundler::URI::RSYNC rsync://rsync.foo.com>

RFC References

A good place to view an RFC spec is www.ietf.org/rfc.html.

Here is a list of all related RFC’s:

Class tree

Copyright Info

Author

Akira Yamada <akira@ruby-lang.org>

Documentation

Akira Yamada <akira@ruby-lang.org> Dmitry V. Sabanin <sdmitry@lrn.ru> Vincent Batts <vbatts@hashbangbash.com>

License

Copyright © 2001 akira yamada <akira@ruby-lang.org> You can redistribute it and/or modify it under the same term as Ruby.















Public Class Methods

URI(uri) click to toggle source
# File bundler/vendored_uri.rb, line 16
def URI(uri) # rubocop:disable Naming/MethodName
  Bundler::URI(uri)
end

Public Instance Methods

match_gem?(platform, gem_name) click to toggle source
# File bundler/rubygems_ext.rb, line 260
def match_gem?(platform, gem_name)
  match_platforms?(platform, Gem.platforms)
end
match_platforms?(platform, platforms) click to toggle source
# File bundler/rubygems_ext.rb, line 273
def match_platforms?(platform, platforms)
  platforms.any? do |local_platform|
    platform.nil? ||
      local_platform == platform ||
      (local_platform != Gem::Platform::RUBY && platform =~ local_platform)
  end
end
match_spec?(spec) click to toggle source
# File bundler/rubygems_ext.rb, line 256
def match_spec?(spec)
  match_gem?(spec.platform, spec.name)
end

Private Instance Methods

URI(uri) click to toggle source
# File bundler/vendored_uri.rb, line 16
def URI(uri) # rubocop:disable Naming/MethodName
  Bundler::URI(uri)
end