Results for: "to_proc"

No documentation available

Performs a Miller-Rabin probabilistic primality test for bn.

checks parameter is deprecated in version 3.0. It has no effect.

Enter error recovering mode. This method does not call on_error.

Leave error recovering mode.

Returns the broadcast address of ifaddr. nil is returned if the flags doesn’t have IFF_BROADCAST.

Logs a message at the error (syslog warning) log level, or logs the message returned from the block.

Same as IO.

Same as IO.

Returns the number of native file system blocks allocated for this file, or nil if the operating system doesn’t support this feature.

File.stat("testfile").blocks   #=> 2

Returns true if stat is a zero-length file; false otherwise.

File.stat("testfile").zero?   #=> false

Returns true if stat is a socket, false if it isn’t or if the operating system doesn’t support this feature.

File.stat("testfile").socket?   #=> false

Returns true if the file is a block device, false if it isn’t or if the operating system doesn’t support this feature.

File.stat("testfile").blockdev?    #=> false
File.stat("/dev/hda1").blockdev?   #=> true

If the buffer is locked, meaning it is inside locked block execution. Locked buffer can’t be resized or freed, and another lock can’t be acquired on it.

Locking is not thread safe, but is a semantic used to ensure buffers don’t move while being used by a system call.

Example:

buffer.locked do
  buffer.write(io) # theoretical system call interface
end

Allows to process a buffer in exclusive way, for concurrency-safety. While the block is performed, the buffer is considered locked, and no other code can enter the lock. Also, locked buffer can’t be changed with resize or free.

The following operations acquire a lock: resize, free.

Locking is not thread safe. It is designed as a safety net around non-blocking system calls. You can only share a buffer between threads with appropriate synchronisation techniques.

Example:

buffer = IO::Buffer.new(4)
buffer.locked? #=> false

Fiber.schedule do
  buffer.locked do
    buffer.write(io) # theoretical system call interface
  end
end

Fiber.schedule do
  # in `locked': Buffer already locked! (IO::Buffer::LockedError)
  buffer.locked do
    buffer.set_string("test", 0)
  end
end

Read at most length bytes from io into the buffer, starting at from, and put it in buffer starting from specified offset. If an error occurs, return -errno.

If offset is not given, put it at the beginning of the buffer.

Example:

IO::Buffer.for('test') do |buffer|
  p buffer
  # =>
  # <IO::Buffer 0x00007fca40087c38+4 SLICE>
  # 0x00000000  74 65 73 74         test

  # take 2 bytes from the beginning of urandom,
  # put them in buffer starting from position 2
  buffer.pread(File.open('/dev/urandom', 'rb'), 0, 2, 2)
  p buffer
  # =>
  # <IO::Buffer 0x00007f3bc65f2a58+4 EXTERNAL SLICE>
  # 0x00000000  05 35 73 74         te.5
end

A set of tasks to prepare the file in order to parse it

No documentation available
No documentation available

Sends a LOCK request to the path and gets a response, as an HTTPResponse object.

Sends a UNLOCK request to the path and gets a response, as an HTTPResponse object.

No documentation available
No documentation available

Inserts switch at the head of the list, and associates short, long and negated long options. Arguments are:

switch

OptionParser::Switch instance to be inserted.

short_opts

List of short style options.

long_opts

List of long style options.

nolong_opts

List of long style options with “no-” prefix.

prepend(switch, short_opts, long_opts, nolong_opts)

Opens a block for grouping objects to be pretty printed.

Arguments:

No documentation available
Search took: 4ms  ·  Total Results: 1731