Results for: "Dir.chdir"

Opens the referenced directory.

See Dir.open.

Returns system configuration directory.

This is typically “/etc”, but is modified by the prefix used when Ruby was compiled. For example, if Ruby is built and installed in /usr/local, returns “/usr/local/etc” on other platforms than Windows. On Windows, this always returns the directory provided by the system.

Returns system temporary directory; typically “/tmp”.

Returns true if the named file is a directory, or a symlink that points at a directory, and false otherwise.

file_name can be an IO object.

File.directory?(".")

Creates one or more directories.

FileUtils.mkdir 'test'
FileUtils.mkdir %w(tmp data)
FileUtils.mkdir 'notexist', noop: true  # Does not really create.
FileUtils.mkdir 'tmp', mode: 0700

Creates one or more directories.

FileUtils.mkdir 'test'
FileUtils.mkdir %w(tmp data)
FileUtils.mkdir 'notexist', noop: true  # Does not really create.
FileUtils.mkdir 'tmp', mode: 0700

Creates a directory and all its parent directories. For example,

FileUtils.mkdir_p '/usr/local/lib/ruby'

causes to make following directories, if they do not exist.

You can pass several directories at a time in a list.

Creates a directory and all its parent directories. For example,

FileUtils.mkdir_p '/usr/local/lib/ruby'

causes to make following directories, if they do not exist.

You can pass several directories at a time in a list.

No documentation available
No documentation available

Removes one or more directories.

FileUtils.rmdir 'somedir'
FileUtils.rmdir %w(somedir anydir otherdir)
# Does not really remove directory; outputs message.
FileUtils.rmdir 'somedir', verbose: true, noop: true

Removes one or more directories.

FileUtils.rmdir 'somedir'
FileUtils.rmdir %w(somedir anydir otherdir)
# Does not really remove directory; outputs message.
FileUtils.rmdir 'somedir', verbose: true, noop: true

The path where gem executables are to be installed.

The path were rubygems plugins are to be installed.

The path to the data directory specified by the gem name. If the package is not available as a gem, return nil.

The default directory for binaries

Returns true if the named file is a directory, or a symlink that points at a directory, and false otherwise.

file_name can be an IO object.

File.directory?(".")

The path to the data directory for this gem.

Return the directories that Specification uses to find specs.

Set the directories that Specification uses to find specs. Setting this resets the list of known specs.

Quietly ensure the Gem directory dir contains all the proper subdirectories. If we can’t create a directory due to a permission problem, then we will silently continue.

If mode is given, missing directories are created with this mode.

World-writable directories will never be created.

Paths where RubyGems’ .rb files and bin files are installed

Calls the given block with each member name/value pair; returns self:

Customer = Struct.new(:name, :address, :zip) # => Customer
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joe.each_pair {|(name, value)| p "#{name} => #{value}" }

Output:

"name => Joe Smith"
"address => 123 Maple, Anytown NC"
"zip => 12345"

Returns an Enumerator if no block is given.

Related: each.

Yields all attributes (as symbols) along with the corresponding values or returns an enumerator if no block is given.

require "ostruct"
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.each_pair.to_a   # => [[:country, "Australia"], [:capital, "Canberra"]]

Hash#each is an alias for Hash#each_pair.

Calls the given block with each key-value pair; returns self:

h = {foo: 0, bar: 1, baz: 2}
h.each_pair {|key, value| puts "#{key}: #{value}"} # => {:foo=>0, :bar=>1, :baz=>2}

Output:

foo: 0
bar: 1
baz: 2

Returns a new Enumerator if no block given:

h = {foo: 0, bar: 1, baz: 2}
e = h.each_pair # => #<Enumerator: {:foo=>0, :bar=>1, :baz=>2}:each_pair>
h1 = e.each {|key, value| puts "#{key}: #{value}"}
h1 # => {:foo=>0, :bar=>1, :baz=>2}

Output:

foo: 0
bar: 1
baz: 2
Search took: 2ms  ·  Total Results: 1057