This method is called when some event handler is undefined. event
is :on_XXX, token
is the scanned token, and data
is a data accumulator.
The return value of this method is passed to the next event handler (as of Enumerable#inject
).
See Zlib::GzipReader
documentation for a description.
Returns the full name of this constant. For example: “Foo”
Returns the full name of this constant. For example: “Foo”
Returns the full name of this constant path. For example: “Foo::Bar”
Returns the full name of this constant path. For example: “Foo::Bar”
Returns the full name of this constant. For example: “Foo”
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.
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.
Count source code characters
Example:
left_right = LeftRightLexCount.new left_right.count_lex(LexValue.new(1, :on_lbrace, "{", Ripper::EXPR_BEG)) left_right.count_for_char("{") # => 1 left_right.count_for_char("}") # => 0
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