Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Process::Status#>>
(::Integer num) -> ::Integer
stat >> places → integer
process.c
View on GitHub ↗
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);
}
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:
Example
`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.
Ruby version changes
-
3.3
-
Process::Status#&andProcess::Status#>>are deprecated. [Bug #19868]
-