Top Level Namespace
| Relationships & Source Files | |
| Namespace Children | |
|
Modules:
| |
|
Classes:
ARGF,
Array,
BasicObject,
Binding,
Class,
Complex,
ConditionVariable,
Continuation,
Data,
Dir,
ENV,
Encoding,
Enumerator,
FalseClass,
Fiber,
File,
Float,
Hash,
IO,
Integer,
MatchData,
Method,
Module,
Mutex,
NilClass,
Numeric,
Object,
Proc,
Queue,
Random,
Range,
Rational,
Regexp,
RubyVM,
SizedQueue,
String,
Struct,
Symbol,
Thread,
ThreadGroup,
Time,
TracePoint,
TrueClass,
UnboundMethod | |
|
Exceptions:
ArgumentError,
ClosedQueueError,
EOFError,
EncodingError,
Exception,
FiberError,
FloatDomainError,
FrozenError,
IOError,
IndexError,
Interrupt,
KeyError,
LoadError,
LocalJumpError,
NameError,
NoMemoryError,
NoMethodError,
NotImplementedError,
RangeError,
RegexpError,
RuntimeError,
ScriptError,
SecurityError,
SignalException,
StandardError,
StopIteration,
SyntaxError,
SystemCallError,
SystemExit,
SystemStackError,
ThreadError,
TypeError,
UncaughtThrowError,
ZeroDivisionError,
fatal |
Constant Summary
-
ARGV =
# File 'ruby.c', line 2336
ARGVcontains the command line arguments used to run ruby.A library like OptionParser can be used to process command-line arguments.
rb_argv -
DATA =
# File 'ruby.c', line 2037
$ cat t.rb
puts DATA.gets __END__DATA is a File that contains the data section of the executed file. To create a data section use <tt>__END__</tt>
-
FALSE =
# File 'object.c', line 4344
An obsolete alias of
falseQfalse -
NIL =
# File 'object.c', line 4243
An obsolete alias of
nilQnil -
RUBY_COPYRIGHT =
# File 'version.c', line 72
The copyright string for ruby
MKSTR(copyright)
-
RUBY_DESCRIPTION =
# File 'version.c', line 105
MKSTR(description)
/* MKSTR(description) */ description
-
RUBY_ENGINE =
# File 'version.c', line 76
The engine or interpreter this ruby uses.
ruby_engine_name = MKSTR(engine)
-
RUBY_ENGINE_VERSION =
# File 'version.c', line 81
The version of the engine or interpreter this ruby uses.
(1 ? version : MKSTR(version))
-
RUBY_PATCHLEVEL =
# File 'version.c', line 64
The patchlevel for this ruby. If this is a development build of ruby the patchlevel will be -1
MKINT(patchlevel)
-
RUBY_PLATFORM =
# File 'version.c', line 59
The platform for this ruby
MKSTR(platform)
-
RUBY_RELEASE_DATE =
# File 'version.c', line 55
The date this ruby was released
MKSTR(release_date)
-
RUBY_REVISION =
# File 'version.c', line 68
The SVN revision for this ruby.
MKINT(revision)
-
RUBY_VERSION =
# File 'version.c', line 51
The running version of ruby
(version = MKSTR(version))
-
STDERR =
# File 'io.c', line 13244
Holds the original stderr
rb_stderr -
STDIN =
# File 'io.c', line 13240
Holds the original stdin
rb_stdin -
STDOUT =
# File 'io.c', line 13242
Holds the original stdout
rb_stdout -
TOPLEVEL_BINDING =
# File 'vm.c', line 3178
The Binding of the top level scope
rb_binding_new() -
TRUE =
# File 'object.c', line 4329
An obsolete alias of
trueQtrue
Class Attribute Summary
- $! readonly
-
Process.pid ⇒ Integer
readonly
Returns the process id of this process.
- $& readonly
- $' readonly
- $*(*var) readonly
- $+ readonly
- $, rw
-
$-0
rw
Alias for $/.
-
$-d
readonly
Alias for $DEBUG.
-
$-F
rw
Alias for $;.
- $-i(*var) rw
-
$-K
rw
Alias for $KCODE.
-
$-v
rw
Alias for $VERBOSE.
-
$-w
rw
Alias for $VERBOSE.
- $-W() readonly
- $.(*var) rw
- $/ (also: .$-0) rw
- $0 (also: .$PROGRAM_NAME) rw
- $; (also: .$-F) rw
- $< readonly
- $= rw
-
$>
rw
Alias for $stdout.
- $@ rw
- $\ (also: .$LOADED_FEATURES) readonly
- $\\ rw
- $_ rw
- $` readonly
- $DEBUG (also: .$-d) readonly
- $FILENAME(*var) readonly
- $find_time_numguess readonly
- $KCODE (also: .$-K) rw
-
$LOADED_FEATURES
readonly
Alias for $.
-
$PROGRAM_NAME
rw
Alias for $0.
- $SAFE rw
- $stderr rw
- $stdin readonly
- $stdout (also: .$>) rw
-
$VERBOSE
(also: .$-v, .$-w)
rw
! Defines built-in variables.
-
$VERBOSE=
(also: .$-v=, .$-w=)
rw
! Defines built-in variables.
- $~ rw
Class Method Summary
-
$? ⇒ Boolean
::Process::Statusencapsulates the information on the status of a running or terminated system process.
Class Attribute Details
$! (readonly)
[ GitHub ]# File 'eval.c', line 1818
static VALUE
errinfo_getter(ID id)
{
return get_errinfo();
}
Process.pid ⇒ Integer (readonly)
[ GitHub ]# File 'process.c', line 460
static VALUE
get_pid(void)
{
return PIDT2NUM(getpid());
}
$& (readonly)
[ GitHub ]# File 're.c', line 1837
static VALUE
last_match_getter(void)
{
return rb_reg_last_match(rb_backref_get());
}
$' (readonly)
[ GitHub ]# File 're.c', line 1849
static VALUE
postmatch_getter(void)
{
return rb_reg_match_post(rb_backref_get());
}
$*(*var) (readonly)
[ GitHub ]# File 'io.c', line 12760
static VALUE
argf_argv_getter(ID id, VALUE *var)
{
return argf_argv(*var);
}
$+ (readonly)
[ GitHub ]# File 're.c', line 1855
static VALUE
last_paren_match_getter(void)
{
return rb_reg_match_last(rb_backref_get());
}
$, (rw)
[ GitHub ]# File 'io.c', line 13113
rb_define_hooked_variable("$,", &rb_output_fs, 0, rb_str_setter);
$-0 (rw)
Alias for $/.
# File 'io.c', line 13120
rb_define_hooked_variable("$-0", &rb_rs, 0, rb_str_setter);
$-d (readonly)
Alias for $DEBUG.
# File 'ruby.c', line 2322
rb_define_variable("$-d", &ruby_debug);
$-F (rw)
Alias for $;.
# File 'string.c', line 11212
rb_define_hooked_variable("$-F", &rb_fs, 0, rb_fs_setter);
$-i(*var) (rw)
[ GitHub ]# File 'io.c', line 12678
static VALUE
opt_i_get(ID id, VALUE *var)
{
return argf_inplace_mode_get(*var);
}
$-K (rw)
Alias for $KCODE.
$-v (rw)
Alias for $VERBOSE.
# File 'ruby.c', line 2318
rb_define_hooked_variable("$-v", &ruby_verbose, 0, verbose_setter);
$-W() (readonly)
[ GitHub ]# File 'ruby.c', line 2297
static VALUE
opt_W_getter(ID id, void *data)
{
VALUE *variable = data;
switch (*variable) {
case Qnil:
return INT2FIX(0);
case Qfalse:
return INT2FIX(1);
case Qtrue:
return INT2FIX(2);
default:
return Qnil;
}
}
$-w (rw)
Alias for $VERBOSE.
# File 'ruby.c', line 2319
rb_define_hooked_variable("$-w", &ruby_verbose, 0, verbose_setter);
$.(*var) (rw)
[ GitHub ]# File 'io.c', line 8758
static VALUE
argf_lineno_getter(ID id, VALUE *var)
{
VALUE argf = *var;
return INT2FIX(ARGF.last_lineno);
}
$/ (rw) Also known as: ::$-0
[ GitHub ]# File 'io.c', line 13119
rb_define_hooked_variable("$/", &rb_rs, 0, rb_str_setter);
$0 (rw) Also known as: ::$PROGRAM_NAME
[ GitHub ]# File 'ruby.c', line 2324
rb_define_hooked_variable("$0", &rb_progname, 0, set_arg0);
$; (rw) Also known as: ::$-F
[ GitHub ]# File 'string.c', line 11211
rb_define_hooked_variable("$;", &rb_fs, 0, rb_fs_setter);
$< (readonly)
[ GitHub ]# File 'io.c', line 13323
rb_define_readonly_variable("$<", &argf);
$= (rw)
[ GitHub ]# File 're.c', line 3945
static VALUE
ignorecase_getter(void)
{
rb_warn("variable $= is no longer effective");
return Qfalse;
}
$> (rw)
Alias for $stdout.
# File 'io.c', line 13235
rb_define_hooked_variable("$>", &rb_stdout, 0, stdout_setter);
$@ (rw)
[ GitHub ]# File 'eval.c', line 1853
static VALUE
errat_getter(ID id)
{
VALUE err = get_errinfo();
if (!NIL_P(err)) {
return rb_get_backtrace(err);
}
else {
return Qnil;
}
}
$\ (readonly) Also known as: ::$LOADED_FEATURES
[ GitHub ]# File 'load.c', line 151
static VALUE
get_loaded_features(void)
{
return GET_VM()->loaded_features;
}
$\\ (rw)
[ GitHub ]# File 'io.c', line 13121
rb_define_hooked_variable("$\\", &rb_output_rs, 0, rb_str_setter);
$_ (rw)
[ GitHub ]$` (readonly)
[ GitHub ]# File 're.c', line 1843
static VALUE
prematch_getter(void)
{
return rb_reg_match_pre(rb_backref_get());
}
$DEBUG (readonly) Also known as: ::$-d
[ GitHub ]# File 'ruby.c', line 2321
rb_define_variable("$DEBUG", &ruby_debug);
$FILENAME(*var) (readonly)
[ GitHub ]# File 'io.c', line 12511
static VALUE
argf_filename_getter(ID id, VALUE *var)
{
return argf_filename(*var);
}
$find_time_numguess (readonly)
[ GitHub ]# File 'time.c', line 3019
static VALUE find_time_numguess_getter(void)
{
return ULL2NUM(find_time_numguess);
}
$KCODE (rw) Also known as: ::$-K
[ GitHub ]# File 're.c', line 3932
static VALUE
kcode_getter(void)
{
rb_warn("variable $KCODE is no longer effective");
return Qnil;
}
$LOADED_FEATURES (readonly)
Alias for $.
$PROGRAM_NAME (rw)
Alias for $0.
# File 'ruby.c', line 2325
rb_define_hooked_variable("$PROGRAM_NAME", &rb_progname, 0, set_arg0);
$SAFE (rw)
[ GitHub ]# File 'safe.c', line 68
static VALUE
safe_getter(void)
{
return INT2NUM(rb_safe_level());
}
$stderr (rw)
[ GitHub ]# File 'io.c', line 13233
rb_define_hooked_variable("$stderr", &rb_stderr, 0, stdout_setter);
$stdin (readonly)
[ GitHub ]# File 'io.c', line 13229
rb_define_variable("$stdin", &rb_stdin);
$stdout (rw) Also known as: ::$>
[ GitHub ]# File 'io.c', line 13231
rb_define_hooked_variable("$stdout", &rb_stdout, 0, stdout_setter);
$VERBOSE (rw) Also known as: ::$-v, ::$-w
! Defines built-in variables
# File 'ruby.c', line 2317
rb_define_hooked_variable("$VERBOSE", &ruby_verbose, 0, verbose_setter);
$VERBOSE= (rw) Also known as: ::$-v=, ::$-w=
! Defines built-in variables
# File 'ruby.c', line 2290
static void
verbose_setter(VALUE val, ID id, void *data)
{
VALUE *variable = data;
*variable = RTEST(val) ? Qtrue : val;
}
$~ (rw)
[ GitHub ]# File 're.c', line 3958
static VALUE
match_getter(void)
{
VALUE match = rb_backref_get();
if (NIL_P(match)) return Qnil;
rb_match_busy(match);
return match;
}
Class Method Details
$? ⇒ Boolean
::Process::Status encapsulates the information on the status of a running or terminated system process. The built-in variable $? is either nil or a ::Process::Status object.
fork { exit 99 } #=> 26557
Process.wait #=> 26557
$?.class #=> Process::Status
$?.to_i #=> 25344
$? >> 8 #=> 99
$?.stopped? #=> false
$?.exited? #=> true
$?.exitstatus #=> 99
Posix systems record information on processes using a 16-bit integer. The lower bits record the process status (stopped, exited, signaled) and the upper bits possibly contain additional information (for example the program’s return code in the case of exited processes). Pre Ruby 1.8, these bits were exposed directly to the Ruby program. Ruby now encapsulates these in a ::Process::Status object. To maximize compatibility, however, these objects retain a bit-oriented interface. In the descriptions that follow, when we talk about the integer value of stat, we’re referring to this 16 bit value.
# File 'process.c', line 522
VALUE
rb_last_status_get(void)
{
return GET_THREAD()->last_status;
}