Method: Process::Status#>>
- Defined in:
- process.c
#>>(places) ⇒ Integer
This method is deprecated as #to_i value is system-specific; use predicate methods like #exited? or #stopped?, or getters like #exitstatus or #stopsig.
Returns the value of #to_i, shifted places
to the right:
`cat /nop`
stat = $? # => #<Process::Status: pid 1155508 exit 1>
stat.to_i # => 256
stat >> 1 # => 128
stat >> 2 # => 64
ArgumentError is raised if places
is negative.
949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 |
# File 'process.c', line 949
static VALUE
pst_rshift(VALUE st1, VALUE st2)
{
int status = PST2INT(st1);
int places = NUM2INT(st2);
if (places < 0) {
rb_raise(rb_eArgError, "negative shift value: %d", places);
}
#define WARN_SUGGEST(suggest) \
rb_warn_deprecated_to_remove_at(3.5, "Process::Status#>>", suggest)
switch (places) {
case 7:
WARN_SUGGEST("Process::Status#coredump?");
break;
case 8:
WARN_SUGGEST("Process::Status#exitstatus or Process::Status#stopsig");
break;
default:
WARN_SUGGEST("other Process::Status attributes");
break;
}
#undef WARN_SUGGEST
status >>= places;
return INT2NUM(status);
}
|