Results for: "Dir.chdir"

Same as Dir.rmdir, except multiple directories are allowed.

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

Yields each environment variable name and value.

If no block is given an Enumerator is returned.

Returns an array with bindir attached to each executable in the executables list

No documentation available

creates a temporary directory with hax TODO: deprecate and remove

Redirects to url with a WEBrick::HTTPStatus::Redirect status.

Example:

res.set_redirect WEBrick::HTTPStatus::TemporaryRedirect

Quietly ensure the Gem directory dir contains all the proper subdirectories for handling default gems. 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.

Returns the first element, or the first n elements, of the array. If the array is empty, the first form returns nil, and the second form returns an empty array. See also Array#last for the opposite effect.

a = [ "q", "r", "s", "t" ]
a.first     #=> "q"
a.first(2)  #=> ["q", "r"]

Array Difference

Returns a new array that is a copy of the receiver, removing any items that also appear in any of the arrays given as arguments. The order is preserved from the original array.

It compares elements using their hash and eql? methods for efficiency.

[ 1, 1, 2, 2, 3, 3, 4, 5 ].difference([ 1, 2, 4 ])     #=> [ 3, 3, 5 ]
[ 1, 'c', :s, 'yep' ].difference([ 1 ], [ 'a', 'c' ])  #=> [ :s, "yep" ]

If you need set-like behavior, see the library class Set.

See also Array#-.

Extracts the nested value specified by the sequence of idx objects by calling dig at each step, returning nil if any intermediate step is nil.

a = [[1, [2, 3]]]

a.dig(0, 1, 1)                    #=> 3
a.dig(1, 2, 3)                    #=> nil
a.dig(0, 0, 0)                    #=> TypeError: Integer does not have #dig method
[42, {foo: :bar}].dig(1, :foo)    #=> :bar

Returns a Digest subclass by name in a thread-safe manner even when on-demand loading is involved.

require 'digest'

Digest("MD5")
# => Digest::MD5

Digest(:SHA256)
# => Digest::SHA256

Digest(:Foo)
# => LoadError: library not found for class Digest::Foo -- digest/foo

Prints obj on the given port (default $>). Equivalent to:

def display(port=$>)
  port.write self
  nil
end

For example:

1.display
"cat".display
[ 4, 5, 6 ].display
puts

produces:

1cat[4, 5, 6]

Performs integer division: returns the integer result of dividing int by numeric.

See Numeric#divmod.

Returns the floating point result of dividing int by numeric.

654321.fdiv(13731)      #=> 47.652829364212366
654321.fdiv(13731.24)   #=> 47.65199646936475
-654321.fdiv(13731)     #=> -47.652829364212366
Search took: 4ms  ·  Total Results: 1179