Produces a version of str
with all non-printing characters replaced by \nnn
notation and all special characters escaped.
"hello \n ''".dump #=> "\"hello \\n ''\""
Returns an array of the Integer
ordinals of the characters in str. This is a shorthand for str.each_codepoint.to_a
.
If a block is given, which is a deprecated form, works the same as each_codepoint
.
Returns a copy of str with all characters in the intersection of its arguments deleted. Uses the same rules for building the set of characters as String#count
.
"hello".delete "l","lo" #=> "heo" "hello".delete "lo" #=> "he" "hello".delete "aeiou", "^e" #=> "hell" "hello".delete "ej-m" #=> "ho"
Performs a delete
operation in place, returning str, or nil
if str was not modified.
Returns 0 if the value is positive, pi otherwise.
Returns the file descriptor used in dir.
d = Dir.new("..") d.fileno #=> 8
This method uses dirfd() function defined by POSIX 2008. NotImplementedError
is raised on other platforms, such as Windows, which doesn’t provide the function.
Deletes the named directory. Raises a subclass of SystemCallError
if the directory isn’t empty.
Deletes the named files, returning the number of names passed as arguments. Raises an exception on any error. Since the underlying implementation relies on the unlink(2)
system call, the type of exception raised depends on its error type (see linux.die.net/man/2/unlink) and has the form of e.g. Errno::ENOENT
.
See also Dir::rmdir
.
Returns true
if the named file is readable by the effective user and group id of this process. See eaccess(3).
Returns true
if the named file is writable by the effective user and group id of this process. See eaccess(3).
Returns true
if the named file is executable by the effective user and group id of this process. See eaccess(3).
Returns true
if the named file
exists and is a regular file.
file
can be an IO
object.
If the file
argument is a symbolic link, it will resolve the symbolic link and use the file referenced by the link.
Returns true for dummy encodings. A dummy encoding is an encoding for which character handling is not properly implemented. It is used for stateful encodings.
Encoding::ISO_2022_JP.dummy? #=> true Encoding::UTF_8.dummy? #=> false
Returns the return value of the iterator.
o = Object.new def o.each yield 1 yield 2 yield 3 100 end e = o.to_enum puts e.next #=> 1 puts e.next #=> 2 puts e.next #=> 3 begin e.next rescue StopIteration => ex puts ex.result #=> 100 end
Multiply by the specified value.
e.g.
c = a.mult(b,n) c = a * b
If specified and less than the number of significant digits of the result, the result is rounded to that number of digits, according to BigDecimal.mode
.
Method
used to provide marshalling support.
inf = BigDecimal('Infinity') #=> Infinity BigDecimal._load(inf._dump) #=> Infinity
See the Marshal
module.
Returns true if the given year is a leap year of the proleptic Gregorian calendar.
Date.gregorian_leap?(1900) #=> false Date.gregorian_leap?(2000) #=> true
Returns true if the date is before the day of calendar reform.
Date.new(1582,10,15).julian? #=> false (Date.new(1582,10,15) - 1).julian? #=> true
Returns true if the year is a leap year.
Date.new(2000).leap? #=> true Date.new(2001).leap? #=> false
This method is equivalent to new_start
(Date::JULIAN
).
Returns the number of entries in the database.
Deletes an entry from the database.