Results for: "remove_const"

Returns true if self is greater than 0, false otherwise.

Returns true if self is less than 0, false otherwise.

Returns true if num is a real number (i.e. not Complex).

Returns self.

Returns true if the length of self is zero, false otherwise:

"hello".empty? # => false
" ".empty? # => false
"".empty? # => true

Replaces the contents of self with the contents of other_string:

s = 'foo'        # => "foo"
s.replace('bar') # => "bar"
No documentation available

Prepends each string in other_strings to self and returns self:

s = 'foo'
s.prepend('bar', 'baz') # => "barbazfoo"
s                       # => "barbazfoo"

Related: String#concat.

Returns self modulo other as a float.

For float f and real number r, these expressions are equivalent:

f % r
f-r*(f/r).floor
f.divmod(r)[1]

See Numeric#divmod.

Examples:

10.0 % 2              # => 0.0
10.0 % 3              # => 1.0
10.0 % 4              # => 2.0

10.0 % -2             # => 0.0
10.0 % -3             # => -2.0
10.0 % -4             # => -2.0

10.0 % 4.0            # => 2.0
10.0 % Rational(4, 1) # => 2.0

Float#modulo is an alias for Float#%.

Returns a 2-element array [q, r], where

q = (self/other).floor      # Quotient
r = self % other            # Remainder

Examples:

11.0.divmod(4)              # => [2, 3.0]
11.0.divmod(-4)             # => [-3, -1.0]
-11.0.divmod(4)             # => [-3, 1.0]
-11.0.divmod(-4)            # => [2, -3.0]

12.0.divmod(4)              # => [3, 0.0]
12.0.divmod(-4)             # => [-3, 0.0]
-12.0.divmod(4)             # => [-3, -0.0]
-12.0.divmod(-4)            # => [3, -0.0]

13.0.divmod(4.0)            # => [3, 1.0]
13.0.divmod(Rational(4, 1)) # => [3, 1.0]

Returns true if float is greater than 0.

Returns true if float is less than 0.

Returns the current fiber. If you are not running in the context of a fiber this method will return the root fiber.

Resumes the fiber from the point at which the last Fiber.yield was called, or starts running it if it is the first call to resume. Arguments passed to resume will be the value of the Fiber.yield expression or will be passed as block parameters to the fiber’s block if this is the first resume.

Alternatively, when resume is called it evaluates to the arguments passed to the next Fiber.yield statement inside the fiber’s block or to the block value if it runs to completion without any Fiber.yield

Returns true if the fiber can still be resumed (or transferred to). After finishing execution of the fiber block this method will always return false.

Calls the block once for each entry in the named directory, passing the filename of each entry as a parameter to the block.

If no block is given, an enumerator is returned instead.

Dir.foreach("testdir") {|x| puts "Got #{x}" }

produces:

Got .
Got ..
Got config.h
Got main.rb

Returns an array containing all of the filenames except for “.” and “..” in the given directory. Will raise a SystemCallError if the named directory doesn’t exist.

The optional encoding keyword argument specifies the encoding of the directory. If not specified, the filesystem encoding is used.

Dir.children("testdir")   #=> ["config.h", "main.rb"]

Reads the next entry from dir and returns it as a string. Returns nil at the end of the stream.

d = Dir.new("testdir")
d.read   #=> "."
d.read   #=> ".."
d.read   #=> "config.h"

Returns an array containing all of the filenames except for “.” and “..” in this directory.

d = Dir.new("testdir")
d.children   #=> ["config.h", "main.rb"]

Repositions dir to the first entry.

d = Dir.new("testdir")
d.read     #=> "."
d.rewind   #=> #<Dir:0x401b3fb0>
d.read     #=> "."

Returns true if the named file is an empty directory, false if it is not a directory or non-empty.

Changes permission bits on the named file(s) to the bit pattern represented by mode_int. Actual effects are operating system dependent (see the beginning of this section). On Unix systems, see chmod(2) for details. Returns the number of files processed.

File.chmod(0644, "testfile", "out")   #=> 2

Equivalent to File::chmod, but does not follow symbolic links (so it will change the permissions associated with the link, not the file referenced by the link). Often not available.

Returns the name of the file referenced by the given link. Not available on all platforms.

File.symlink("testfile", "link2test")   #=> 0
File.readlink("link2test")              #=> "testfile"

Renames the given file to the new name. Raises a SystemCallError if the file cannot be renamed.

File.rename("afile", "afile.bak")   #=> 0
Search took: 4ms  ·  Total Results: 3564