Results for: "String#[]"

Attempts to enter exclusive section. Returns false if lock fails.

Iterates over each line in the file and yields a String object for each.

Creates a hard link at pathname.

See File.link.

Creates a symbolic link.

See File.symlink.

See FileTest.world_writable?.

See FileTest.writable_real?.

Iterates over the entries (files and subdirectories) in the directory, yielding a Pathname object for each entry.

No documentation available

Packs port and host as an AF_INET/AF_INET6 sockaddr string.

Socket.sockaddr_in(80, "127.0.0.1")
#=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"

Socket.sockaddr_in(80, "::1")
#=> "\n\x00\x00P\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00"

Disallows further write using shutdown system call.

UNIXSocket.pair {|s1, s2|
  s1.print "ping"
  s1.close_write
  p s2.read        #=> "ping"
  s2.print "pong"
  s2.close
  p s1.read        #=> "pong"
}
No documentation available

creates a new Socket connected to the address of local_addrinfo.

If local_addrinfo is nil, the address of the socket is not bound.

The timeout specify the seconds for timeout. Errno::ETIMEDOUT is raised when timeout occur.

If a block is given the created socket is yielded for each address.

returns a string which shows the sockaddr in addrinfo with human-readable form.

Addrinfo.tcp("localhost", 80).inspect_sockaddr     #=> "127.0.0.1:80"
Addrinfo.tcp("ip6-localhost", 80).inspect_sockaddr #=> "[::1]:80"
Addrinfo.unix("/tmp/sock").inspect_sockaddr        #=> "/tmp/sock"

Returns true for IPv4 private address (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16). It returns false otherwise.

Returns true for IPv4 multicast address (224.0.0.0/4). It returns false otherwise.

Returns true for IPv6 multicast address (ff00::/8). It returns false otherwise.

Returns true for IPv6 link local address (fe80::/10). It returns false otherwise.

Closes self for writing; closed-read setting remains unchanged.

Raises IOError if writing is attempted.

Related: StringIO#close, StringIO#close_read.

Returns true if self is closed for writing, false otherwise.

Calls the block with each remaining line read from the stream; does nothing if already at end-of-file; returns self. See Line IO.

With a block given, calls the block with each remaining codepoint in the stream; see Codepoint IO.

With no block given, returns an enumerator.

Returns a shallow copy of self; the [stored string] in the copy is the same string as in self.

Returns the substring that follows the matched substring from the most recent match attempt if it was successful, or nil otherwise; see [Basic Match Values]:

scanner = StringScanner.new('foobarbaz')
scanner.post_match     # => nil

scanner.pos = 3
scanner.match?(/bar/)  # => 3
scanner.post_match     # => "baz"

scanner.match?(/nope/) # => nil
scanner.post_match     # => nil

Returns the size (in bytes) of the rest of the [stored string]:

scanner = StringScanner.new('foobarbaz')
scanner.rest      # => "foobarbaz"
scanner.rest_size # => 9
scanner.pos = 3
scanner.rest      # => "barbaz"
scanner.rest_size # => 6
scanner.terminate
scanner.rest      # => ""
scanner.rest_size # => 0
No documentation available
Search took: 5ms  ·  Total Results: 2715