Results for: "remove_const"

Returns whether sym is :“” or not.

Returns the parent directory.

This is same as self + '..'.

Returns true if self points to a mountpoint.

Returns the children of the directory (files and subdirectories, not recursive) as an array of Pathname objects.

By default, the returned pathnames will have enough information to access the files. If you set with_directory to false, then the returned pathnames will contain the filename only.

For example:

pn = Pathname("/usr/lib/ruby/1.8")
pn.children
    # -> [ Pathname:/usr/lib/ruby/1.8/English.rb,
           Pathname:/usr/lib/ruby/1.8/Env.rb,
           Pathname:/usr/lib/ruby/1.8/abbrev.rb, ... ]
pn.children(false)
    # -> [ Pathname:English.rb, Pathname:Env.rb, Pathname:abbrev.rb, ... ]

Note that the results never contain the entries . and .. in the directory because they are not children.

Recursively deletes a directory, including all directories beneath it.

See FileUtils.rm_r

Freezes this Pathname.

See Object.freeze.

Returns the real (absolute) pathname for self in the actual filesystem.

Does not contain symlinks or useless dots, .. and ..

All components of the pathname must exist when this method is called.

Returns the real (absolute) pathname of self in the actual filesystem.

Does not contain symlinks or useless dots, .. and ..

The last component of the real pathname can be nonexistent.

Returns all data from the file, or the first N bytes if specified.

See File.read.

Returns all the bytes from the file, or the first N if specified.

See File.binread.

Returns all the lines from the file.

See File.readlines.

Changes file permissions.

See File.chmod.

Same as Pathname.chmod, but does not follow symbolic links.

See File.lchmod.

Read symbolic link.

See File.readlink.

Rename the file.

See File.rename.

See FileTest.directory?.

See FileTest.readable?.

Tests the file is empty.

See Dir#empty? and FileTest.empty?.

Returns true if the database is empty.

Iterates over the key-value pairs in the database, deleting those for which the block returns true.

Creates a new Hash using the key-value pairs from the database, then calls Hash#reject with the given block, which returns a Hash with only the key-value pairs for which the block returns false.

Returns a Hash in which the key-value pairs have been inverted.

Example:

require 'sdbm'

SDBM.open 'my_database' do |db|
  db.update('apple' => 'fruit', 'spinach' => 'vegetable')

  db.invert  #=> {"fruit" => "apple", "vegetable" => "spinach"}
end

Empties the database, then inserts the given key-value pairs.

This method will work with any object which implements an each_pair method, such as a Hash.

Returns true if the database contains the given key.

Receives up to maxlen bytes from socket. flags is zero or more of the MSG_ options. The first element of the results, mesg, is the data received. The second element, sender_addrinfo, contains protocol-specific address information of the sender.

Parameters

Example

# In one file, start this first
require 'socket'
include Socket::Constants
socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
socket.bind( sockaddr )
socket.listen( 5 )
client, client_addrinfo = socket.accept
data = client.recvfrom( 20 )[0].chomp
puts "I only received 20 bytes '#{data}'"
sleep 1
socket.close

# In another file, start this second
require 'socket'
include Socket::Constants
socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
socket.connect( sockaddr )
socket.puts "Watch this get cut short!"
socket.close

Unix-based Exceptions

On unix-based based systems the following system exceptions may be raised if the call to recvfrom fails:

Windows Exceptions

On Windows systems the following system exceptions may be raised if the call to recvfrom fails:

Search took: 5ms  ·  Total Results: 3993