Returns a hash containing the counts of equal elements:
Each key is an element of self
.
Each value is the number elements equal to that key.
With no argument:
%w[a b c b c a c b].tally # => {"a"=>2, "b"=>3, "c"=>3}
With a hash argument, that hash is used for the tally (instead of a new hash), and is returned; this may be useful for accumulating tallies across multiple enumerables:
hash = {} hash = %w[a c d b c a].tally(hash) hash # => {"a"=>2, "c"=>2, "d"=>1, "b"=>1} hash = %w[b a z].tally(hash) hash # => {"a"=>3, "c"=>2, "d"=>1, "b"=>2, "z"=>1} hash = %w[b a m].tally(hash) hash # => {"a"=>4, "c"=>2, "d"=>1, "b"=>3, "z"=>1, "m"=> 1}
SystemCallError
is the base class for all low-level platform-dependent errors.
The errors available on the current platform are subclasses of SystemCallError
and are defined in the Errno
module.
File.open("does/not/exist")
raises the exception:
Errno::ENOENT: No such file or directory - does/not/exist
Helper methods for both Gem::Installer
and Gem::Uninstaller
Response class for Method Not Allowed
responses (status code 405).
The request method is not supported for the requested resource.
References:
Represents assigning to a method call.
foo.bar, = 1 ^^^^^^^ begin rescue => foo.bar ^^^^^^^ end for foo.bar in baz do end ^^^^^^^
Installs a gem along with all its dependencies from local and remote gems.
Raised when removing a gem with the uninstall command fails
The installer installs the files contained in the .gem into the Gem.home.
Gem::Installer
does the work of putting files in all the right places on the filesystem including unpacking the gem into its gem dir, installing the gemspec in the specifications dir, storing the cached gem in the cache dir, and installing either wrappers or symlinks for executables.
The installer invokes pre and post install hooks. Hooks can be added either through a rubygems_plugin.rb file in an installed gem or via a rubygems/defaults/#{RUBY_ENGINE}.rb or rubygems/defaults/operating_system.rb file. See Gem.pre_install
and Gem.post_install
for details.
An Uninstaller
.
The uninstaller fires pre and post uninstall hooks. Hooks can be added either through a rubygems_plugin.rb file in an installed gem or via a rubygems/defaults/#{RUBY_ENGINE}.rb or rubygems/defaults/operating_system.rb file. See Gem.pre_uninstall
and Gem.post_uninstall
for details.
Mixin methods for install and update options for Gem::Commands
Socket::AncillaryData
represents the ancillary data (control information) used by sendmsg and recvmsg system call. It contains socket family
, control message (cmsg) level
, cmsg type
and cmsg data
.
Response class for Not Acceptable
responses (status code 406).
The requested resource is capable of generating only content that not acceptable according to the Accept headers sent in the request.
References:
Response class for Variant Also Negotiates
responses (status code 506).
Transparent content negotiation for the request results in a circular reference.
References:
Represents the use of the ‘alias` keyword to alias a global variable.
alias $foo $bar ^^^^^^^^^^^^^^^
Represents the use of the ‘&&=` operator on a call.
foo.bar &&= value ^^^^^^^^^^^^^^^^^
Represents a method call, in all of the various forms that can take.
foo ^^^ foo() ^^^^^ +foo ^^^^ foo + bar ^^^^^^^^^ foo.bar ^^^^^^^ foo&.bar ^^^^^^^^
Represents the use of an assignment operator on a call.
foo.bar += baz ^^^^^^^^^^^^^^
Represents the use of the ‘||=` operator on a call.
foo.bar ||= value ^^^^^^^^^^^^^^^^^