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.
/usr
/usr/local
/usr/local/lib
/usr/local/lib/ruby
You can pass several directories at a time in a list.
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 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?(".")
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.
Creates a remote directory.
Removes a remote directory.
The path to the data directory for this gem.
Sets the vendordir entry in RbConfig::CONFIG to value
and restores the original value when the block ends
Sets the bindir entry in RbConfig::CONFIG to value
and restores the original value when the block ends
Is code
a redirection status?
Is code
a redirection status?
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 block once for each [key, value] pair in the database. Returns self.
Yields the name and value of each struct member in order. If no block is given an enumerator is returned.
Customer = Struct.new(:name, :address, :zip) joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) joe.each_pair {|name, value| puts("#{name} => #{value}") }
Produces:
name => Joe Smith address => 123 Maple, Anytown NC zip => 12345
Executes block for each key in the database, passing the key and the corresponding value as a parameter.
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"]]
Iterates over each key-value pair in the database.
If no block is given, returns an Enumerator
.
Calls block once for each key in hsh, passing the key-value pair as parameters.
If no block is given, an enumerator is returned instead.
h = { "a" => 100, "b" => 200 } h.each {|key, value| puts "#{key} is #{value}" }
produces:
a is 100 b is 200