Returns an address of the socket suitable for connect in the local machine.
This method returns self.local_address, except following condition.
IPv4 unspecified address (0.0.0.0) is replaced by IPv4 loopback address (127.0.0.1).
IPv6 unspecified address (::) is replaced by IPv6 loopback address (::1).
If the local address is not suitable for connect, SocketError is raised. IPv4 and IPv6 address which port is 0 is not suitable for connect. Unix domain socket which has no path is not suitable for connect.
Addrinfo.tcp("0.0.0.0", 0).listen {|serv| p serv.connect_address #=> #<Addrinfo: 127.0.0.1:53660 TCP> serv.connect_address.connect {|c| s, _ = serv.accept p [c, s] #=> [#<Socket:fd 4>, #<Socket:fd 6>] } }
If obj is a Hash object, returns obj.
Otherwise if obj responds to :to_hash, calls obj.to_hash and returns the result.
Returns nil if obj does not respond to :to_hash
Raises an exception unless obj.to_hash returns a Hash object.
Enters exclusive section and executes the block.  Leaves the exclusive section automatically when the block exits.  See example under MonitorMixin.
Adds a pre-install hook that will be passed an Gem::Installer instance when Gem::Installer#install is called.  If the hook returns false then the install will be aborted.
Adds a pre-uninstall hook that will be passed an Gem::Uninstaller instance and the spec that will be uninstalled when Gem::Uninstaller#uninstall is called
Copies IO stream src to IO stream dest via IO.copy_stream.
Related: methods for copying.
Copies IO stream src to IO stream dest via IO.copy_stream.
Related: methods for copying.
Returns the convertible integer type of the given type.  You may optionally specify additional headers to search in for the type. convertible means actually the same type, or typedef’d from the same type.
If the type is an integer type and the convertible type is found, the following macros are passed as preprocessor constants to the compiler using the type name, in uppercase.
TYPEOF_, followed by the type name, followed by =X where “X” is the found convertible type name.
TYP2NUM and NUM2TYP, where TYP is the type name in uppercase with replacing an _t suffix with “T”, followed by =X where “X” is the macro name to convert type to an Integer object, and vice versa.
For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return “unsigned long”, and define these macros:
#define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG
Quietly ensure the Gem directory dir contains all the proper subdirectories.  If we can’t create a directory due to a permission problem, then we will silently continue.
If mode is given, missing directories are created with this mode.
World-writable directories will never be created.
Discard changes that have not been committed and revert the last commit
Cannot revert the first commit
Return the value that should be dumped for the version option.
Smushes logically “consecutive” lines
source = <<~'EOM' User. where(name: 'schneems'). first EOM lines = CleanDocument.new(source: source).join_consecutive!.lines expect(lines[0].to_s).to eq(source) expect(lines[1].to_s).to eq("")
The one known case this doesn’t handle is:
Ripper.lex <<~EOM a && b || c EOM
For some reason this introduces ‘on_ignore_newline` but with BEG type
Returns true if self is a Monday, false otherwise.
Returns the integer month of the year for self, in range (1..12):
t = Time.new(2000, 1, 2, 3, 4, 5, 6) # => 2000-01-02 03:04:05 +000006 t.mon # => 1
Returns the integer month of the year for self, in range (1..12):
t = Time.new(2000, 1, 2, 3, 4, 5, 6) # => 2000-01-02 03:04:05 +000006 t.mon # => 1
Returns true if self represents a Monday, false otherwise:
t = Time.utc(2000, 1, 3) # => 2000-01-03 00:00:00 UTC t.monday? # => true
Related: Time#tuesday?, Time#wednesday?, Time#thursday?.
Returns the ‘rest’ of the [stored string] (all after the current [position]), which is the [target substring]:
scanner = StringScanner.new('foobarbaz') scanner.rest # => "foobarbaz" scanner.pos = 3 scanner.rest # => "barbaz" scanner.terminate scanner.rest # => ""