Results for: "to_proc"

Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc.

Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc.

Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc.

Sets the default proc for self to proc (see Hash Default):

h = {}
h.default_proc # => nil
h.default_proc = proc { |hash, key| "Default value for #{key}" }
h.default_proc.class # => Proc
h.default_proc = nil
h.default_proc # => nil
No documentation available

Invoked by Process::Status.wait in order to wait for a specified process. See that method description for arguments description.

Suggested minimal implementation:

Thread.new do
  Process::Status.wait(pid, flags)
end.value

This hook is optional: if it is not present in the current scheduler, Process::Status.wait will behave as a blocking method.

Expected to return a Process::Status instance.

Stop tracing object allocations.

Note that if ::trace_object_allocations_start is called n-times, then tracing will stop after calling ::trace_object_allocations_stop n-times.

Sets the process title that appears on the ps(1) command. Not necessarily effective on all platforms. No exception will be raised regardless of the result, nor will NotImplementedError be raised even if the platform does not support the feature.

Calling this method does not affect the value of $0.

Process.setproctitle('myapp: worker #%d' % worker_id)

This method first appeared in Ruby 2.1 to serve as a global variable free means to change the process title.

Blocks can have a special set of parameters that automatically expand when given arrays if they have a single required parameter and no other parameters.

Example:

x += 1
  ^

Example:

x += 1
     ^

Example:

Foo::Bar += 1
   ^^^^^^^^

foo += bar

becomes

foo = foo + bar

Returns the number of online processors.

The result is intended as the number of processes to use all available processors.

This method is implemented using:

Example:

require 'etc'
p Etc.nprocessors #=> 4

The result might be smaller number than physical cpus especially when ruby process is bound to specific cpus. This is intended for getting better parallel processing.

Example: (Linux)

linux$ taskset 0x3 ./ruby -retc -e "p Etc.nprocessors"  #=> 2

foo += bar ^^^^^^^^^^

Example:

x.foo += 42
 ^^^     (for foo)
x.foo += 42
      ^  (for +)
x.foo += 42
 ^^^^^^^ (for foo=)

Example:

x.foo += 42
         ^^

Example:

x[1] += 42
 ^^^    (for [])
x[1] += 42
     ^  (for +)
x[1] += 42
 ^^^^^^ (for []=)

Example:

x[1] += 42
  ^^^^^^^^

Returns the scheduling priority for specified process, process group, or user.

Argument kind is one of:

Argument id is the ID for the process, process group, or user; zero specified the current ID for kind.

Examples:

Process.getpriority(Process::PRIO_USER, 0)    # => 19
Process.getpriority(Process::PRIO_PROCESS, 0) # => 19

Not available on all platforms.

See Process.getpriority.

Examples:

Process.setpriority(Process::PRIO_USER, 0, 19)    # => 0
Process.setpriority(Process::PRIO_PROCESS, 0, 19) # => 0
Process.getpriority(Process::PRIO_USER, 0)        # => 19
Process.getpriority(Process::PRIO_PROCESS, 0)     # => 19

Not available on all platforms.

Sets the supplemental group access list; the new list includes:

Example:

Process.groups                # => [0, 1, 2, 3, 4, 6, 10, 11, 20, 26, 27]
Process.initgroups('me', 30)  # => [30, 6, 10, 11]
Process.groups                # => [30, 6, 10, 11]

Not available on all platforms.

Returns an array of the group IDs in the supplemental group access list for the current process:

Process.groups # => [4, 24, 27, 30, 46, 122, 135, 136, 1000]

These properties of the returned array are system-dependent:

Use this call to get a sorted and unique array:

Process.groups.uniq.sort

Sets the supplemental group access list to the given array of group IDs.

Process.groups                     # => [0, 1, 2, 3, 4, 6, 10, 11, 20, 26, 27]
Process.groups = [27, 6, 10, 11]   # => [27, 6, 10, 11]
Process.groups                     # => [27, 6, 10, 11]

Returns the maximum number of group IDs allowed in the supplemental group access list:

Process.maxgroups # => 32
Search took: 2ms  ·  Total Results: 1563