Returns the full name (name-version) of this Gem. Platform information is included (name-version-platform) if it is specified and not the default Ruby platform.
Full path of the target library file. If the file is not in this gem, return nil.
Indicated, based on the requested domain, if remote gems should be considered.
Reads the file index and extracts each file into the gem directory.
Ensures that files can’t be installed outside the gem directory.
Creates an installer for spec
that will install into gem_home
. If user
is true a user-install will be performed.
Returns the full name (name-version) of this Gem. Platform information is included if it is not the default Ruby platform. This mimics the behavior of Gem::Specification#full_name
.
Extracts the files in this package into destination_dir
If pattern
is specified, only entries matching that glob will be extracted.
The content-length header
The content-length header
Sets the content-length header to len
Mounts proc
or block
on dir
and calls it with a WEBrick::HTTPRequest
and WEBrick::HTTPResponse
Returns the source encoding as an encoding object.
Note that the result may not be equal to the source encoding of the encoding converter if the conversion has multiple steps.
ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP") # ISO-8859-1 -> UTF-8 -> EUC-JP begin ec.convert("\xa0") # NO-BREAK SPACE, which is available in UTF-8 but not in EUC-JP. rescue Encoding::UndefinedConversionError p $!.source_encoding #=> #<Encoding:UTF-8> p $!.destination_encoding #=> #<Encoding:EUC-JP> p $!.source_encoding_name #=> "UTF-8" p $!.destination_encoding_name #=> "EUC-JP" end
Returns the source encoding as an encoding object.
Note that the result may not be equal to the source encoding of the encoding converter if the conversion has multiple steps.
ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP") # ISO-8859-1 -> UTF-8 -> EUC-JP begin ec.convert("\xa0") # NO-BREAK SPACE, which is available in UTF-8 but not in EUC-JP. rescue Encoding::UndefinedConversionError p $!.source_encoding #=> #<Encoding:UTF-8> p $!.destination_encoding #=> #<Encoding:EUC-JP> p $!.source_encoding_name #=> "UTF-8" p $!.destination_encoding_name #=> "EUC-JP" end
Returns true if the invalid byte sequence error is caused by premature end of string.
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1") begin ec.convert("abc\xA1z") rescue Encoding::InvalidByteSequenceError p $! #=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "z" on EUC-JP> p $!.incomplete_input? #=> false end begin ec.convert("abc\xA1") ec.finish rescue Encoding::InvalidByteSequenceError p $! #=> #<Encoding::InvalidByteSequenceError: incomplete "\xA1" on EUC-JP> p $!.incomplete_input? #=> true end
Returns the corresponding ASCII compatible encoding.
Returns nil if the argument is an ASCII compatible encoding.
“corresponding ASCII compatible encoding” is an ASCII compatible encoding which can represents exactly the same characters as the given ASCII incompatible encoding. So, no conversion undefined error occurs when converting between the two encodings.
Encoding::Converter.asciicompat_encoding("ISO-2022-JP") #=> #<Encoding:stateless-ISO-2022-JP> Encoding::Converter.asciicompat_encoding("UTF-16BE") #=> #<Encoding:UTF-8> Encoding::Converter.asciicompat_encoding("UTF-8") #=> nil
Returns the source encoding as an Encoding
object.
Synonym for CGI::unescapeElement(str)