Raised by Encoding
and String
methods when the string being transcoded contains a byte invalid for the either the source or target encoding.
Raised by transcoding methods when a named encoding does not correspond with a known converter.
An internal representation of the backtrace. The user will never interact with objects of this class directly, but class methods can be used to get backtrace settings of the current session.
AbstractSyntaxTree
provides methods to parse Ruby code into abstract syntax trees. The nodes in the tree are instances of RubyVM::AbstractSyntaxTree::Node
.
This module is MRI specific as it exposes implementation details of the MRI abstract syntax tree.
This module is experimental and its API is not stable, therefore it might change without notice. As examples, the order of children nodes is not guaranteed, the number of children nodes might change, there is no way to access children nodes by name, etc.
If you are looking for a stable API or an API working under multiple Ruby implementations, consider using the parser gem or Ripper
. If you would like to make RubyVM::AbstractSyntaxTree
stable, please join the discussion at bugs.ruby-lang.org/issues/14844.
A mixin that provides methods for parsing C struct and prototype signatures.
require 'fiddle/import' include Fiddle::CParser #=> Object parse_ctype('int') #=> Fiddle::TYPE_INT parse_struct_signature(['int i', 'char c']) #=> [[Fiddle::TYPE_INT, Fiddle::TYPE_CHAR], ["i", "c"]] parse_signature('double sum(double, double)') #=> ["sum", Fiddle::TYPE_DOUBLE, [Fiddle::TYPE_DOUBLE, Fiddle::TYPE_DOUBLE]]
The WIN32OLE::VARIANT
module includes constants of VARIANT
type constants. The constants is used when creating WIN32OLE_VARIANT object.
obj = WIN32OLE_VARIANT.new("2e3", WIN32OLE::VARIANT::VT_R4) obj.value # => 2000.0
Extends command line arguments array (ARGV) to parse itself.
Flags for arguments nodes.
Flags for range and flip-flop nodes.
Flags for regular expression and match last line nodes.
This module is used for safely loading Marshal
specs from a gem. The ‘safe_load` method defined on this module is specifically designed for loading Gem specifications.
Module
that defines the default UserInteraction
. Any class including this module will have access to the ui
method that returns the default UI.
UserInteraction
allows RubyGems to interact with the user through standard methods that can be replaced with more-specific UI methods for different displays.
Since UserInteraction
dispatches to a concrete UI class you may need to reference other classes for specific behavior such as Gem::ConsoleUI
or Gem::SilentUI
.
Example:
class X include Gem::UserInteraction def get_answer n = ask("What is the meaning of life?") end end
If we have an identifier that follows a method name like:
def foo bar
then Ripper
will mark bar as END|LABEL if there is a local in a parent scope named bar because it hasn’t pushed the local table yet. We do this more accurately, so we need to allow comparing against both END and END|LABEL.