module Gem
Constants
- FLATTENS_REQUIRED_PATHS
Can be removed once RubyGems 3.3.15 support is dropped
- Net
- Random
- SecureRandom
Secure random number generator interface.¶ ↑
This library is an interface to secure random number generators which are suitable for generating session keys in HTTP cookies, etc.
You can use this library in your application by requiring it:
require 'bundler/vendor/securerandom/lib/securerandom'
It supports the following secure random number generators:
-
openssl
-
/dev/urandom
-
Win32
Bundler::SecureRandom
is extended by theBundler::Random::Formatter
module which defines the following methods:-
alphanumeric
-
base64
-
choose
-
gen_random
-
hex
-
rand
-
random_bytes
-
random_number
-
urlsafe_base64
-
uuid
These methods are usable as class methods of
Bundler::SecureRandom
such asBundler::SecureRandom.hex
.If a secure random number generator is not available,
NotImplementedError
is raised.-
- 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¶ ↑
-
Bundler::URI::Generic
(in uri/generic.rb)-
Bundler::URI::File
- (in uri/file.rb) -
Bundler::URI::FTP
- (in uri/ftp.rb) -
Bundler::URI::HTTP
- (in uri/http.rb)-
Bundler::URI::HTTPS
- (in uri/https.rb)
-
-
Bundler::URI::LDAP
- (in uri/ldap.rb)-
Bundler::URI::LDAPS
- (in uri/ldaps.rb)
-
-
Bundler::URI::MailTo
- (in uri/mailto.rb)
-
-
Bundler::URI::Parser
- (in uri/common.rb) -
Bundler::URI::REGEXP
- (in uri/common.rb)-
Bundler::URI::REGEXP::PATTERN - (in uri/common.rb)
-
-
Bundler::URI::Util - (in uri/common.rb)
-
Bundler::URI::Error
- (in uri/common.rb)-
Bundler::URI::InvalidURIError
- (in uri/common.rb) -
Bundler::URI::InvalidComponentError
- (in uri/common.rb) -
Bundler::URI::BadURIError
- (in uri/common.rb)
-
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.
-
- VALIDATES_FOR_RESOLUTION
Can be removed once RubyGems 3.5.14 support is dropped
Public Class Methods
# File bundler/vendored_uri.rb, line 16 def URI(uri) # rubocop:disable Naming/MethodName Bundler::URI(uri) end
# File bundler/rubygems_ext.rb, line 28 def self.freebsd_platform? RbConfig::CONFIG["host_os"].to_s.include?("bsd") end
# File bundler/rubygems_ext.rb, line 38 def open_file_with_flock(path, &block) # read-write mode is used rather than read-only in order to support NFS mode = IO::RDWR | IO::APPEND | IO::CREAT | IO::BINARY mode |= IO::SHARE_DELETE if IO.const_defined?(:SHARE_DELETE) File.open(path, mode) do |io| begin io.flock(File::LOCK_EX) rescue Errno::ENOSYS, Errno::ENOTSUP end yield io end end
# File bundler/rubygems_ext.rb, line 52 def open_file_with_lock(path, &block) file_lock = "#{path}.lock" open_file_with_flock(file_lock, &block) ensure FileUtils.rm_f file_lock end
Public Instance Methods
# File bundler/rubygems_ext.rb, line 359 def match_gem?(platform, gem_name) match_platforms?(platform, Gem.platforms) end
# File bundler/rubygems_ext.rb, line 372 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
# File bundler/rubygems_ext.rb, line 355 def match_spec?(spec) match_gem?(spec.platform, spec.name) end
Private Instance Methods
# File bundler/vendored_uri.rb, line 16 def URI(uri) # rubocop:disable Naming/MethodName Bundler::URI(uri) end