Sets the mode for self
to row mode (see Row Mode); returns self
:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.mode # => :col_or_row table1 = table.by_row! table.mode # => :row table1.equal?(table) # => true # Returned self
Checks if ios
starts with a BOM, and then consumes it and sets the external encoding. Returns the result encoding if found, or nil. If ios
is not binmode or its encoding has been set already, an exception will be raised.
File.write("bom.txt", "\u{FEFF}abc") ios = File.open("bom.txt", "rb") ios.set_encoding_by_bom #=> #<Encoding:UTF-8> File.write("nobom.txt", "abc") ios = File.open("nobom.txt", "rb") ios.set_encoding_by_bom #=> nil
Removes the gemspec matching full_name
from the dependency list
Find
the best specification matching a name
and requirements
. Raises if the dependency doesn’t resolve to a valid specification.
Return the best specification that contains the file matching path
.
Returns a duplicate of self
, in mixed mode (see Mixed Mode):
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true).by_col! table.mode # => :col dup_table = table.by_col_or_row dup_table.mode # => :col_or_row dup_table.equal?(table) # => false # It's a dup
This may be used to chain method calls without changing the mode (but also will affect performance and memory usage):
dup_table.by_col_or_row['Name']
Also note that changes to the duplicate table will not affect the original.
Sets the mode for self
to mixed mode (see Mixed Mode); returns self
:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true).by_col! table.mode # => :col table1 = table.by_col_or_row! table.mode # => :col_or_row table1.equal?(table) # => true # Returned self
Remove everything in the DependencyList
that matches but doesn’t satisfy items in dependencies
(a hash of gem names to arrays of dependencies).
Returns every spec that matches name
and optional requirements
.
Return the best specification that contains the file matching path
amongst the specs that are not activated.
Returns every spec that has the given full_name
mkmf.rb is used by Ruby C extensions to generate a Makefile which will correctly compile and link the C extension to Ruby and a third-party library.
Raised when a gem dependencies file specifies a ruby version that does not match the current version.
The command manager registers and installs all the individual sub-commands supported by the gem command.
Extra commands can be provided by writing a rubygems_plugin.rb file in an installed gem. You should register your command against the Gem::CommandManager
instance, like this:
# file rubygems_plugin.rb require 'rubygems/command_manager' Gem::CommandManager.instance.register_command :edit
You should put the implementation of your command in rubygems/commands.
# file rubygems/commands/edit_command.rb class Gem::Commands::EditCommand < Gem::Command # ... end
See Gem::Command
for instructions on writing gem commands.
Raised when encountering Ruby code with an invalid syntax.
eval("1+1=2")
raises the exception:
SyntaxError: (eval):1: syntax error, unexpected '=', expecting $end