Results for: "module_function"

Returns the birth time for the named file.

file_name can be an IO object.

File.birthtime("testfile")   #=> Wed Apr 09 08:53:13 CDT 2003

If the platform doesn’t have birthtime, raises NotImplementedError.

Sets the access and modification times of each named file to the first two arguments. Returns the number of file names in the argument list.

Deletes the named files, returning the number of names passed as arguments. Raises an exception on any error. See also Dir::rmdir.

Returns the last access time (a Time object)

for <i>file</i>, or epoch if <i>file</i> has not been accessed.

  File.new("testfile").atime   #=> Wed Dec 31 18:00:00 CST 1969

Returns the modification time for file.

File.new("testfile").mtime   #=> Wed Apr 09 08:53:14 CDT 2003

Returns the birth time for file.

File.new("testfile").birthtime   #=> Wed Apr 09 08:53:14 CDT 2003

If the platform doesn’t have birthtime, raises NotImplementedError.

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?(".")

Returns true if the named file has the sticky bit set.

Returns true if the named files are identical.

file_1 and file_2 can be an IO object.

open("a", "w") {}
p File.identical?("a", "a")      #=> true
p File.identical?("a", "./a")    #=> true
File.link("a", "b")
p File.identical?("a", "b")      #=> true
File.symlink("a", "c")
p File.identical?("a", "c")      #=> true
open("d", "w") {}
p File.identical?("a", "d")      #=> false

Returns a string which represents the encoding for programmers.

Encoding::UTF_8.inspect       #=> "#<Encoding:UTF-8>"
Encoding::ISO_2022_JP.inspect #=> "#<Encoding:ISO-2022-JP (dummy)>"

Creates a printable version of e.

Return this exception’s class name and message

Round to the nearest integer (by default), returning the result as a BigDecimal.

BigDecimal('3.14159').round #=> 3
BigDecimal('8.7').round #=> 9
BigDecimal('-9.9').round #=> -10

If n is specified and positive, the fractional part of the result has no more than that many digits.

If n is specified and negative, at least that many digits to the left of the decimal point will be 0 in the result.

BigDecimal('3.14159').round(3) #=> 3.142
BigDecimal('13345.234').round(-2) #=> 13300.0

The value of the optional mode argument can be used to determine how rounding is performed; see BigDecimal.mode.

Returns self if the value is non-zero, nil otherwise.

Returns debugging information about the value as a string of comma-separated values in angle brackets with a leading #:

BigDecimal.new("1234.5678").inspect
  #=> "0.12345678e4"

The first part is the address, the second is the value as a string, and the final part ss(mm) is the current number of significant digits and the maximum number of significant digits, respectively.

Returns the exponent of the BigDecimal number, as an Integer.

If the number can be represented as 0.xxxxxx*10**n where xxxxxx is a string of digits with no leading zeros, then n is the exponent.

Returns true if rat is greater than 0.

Returns true if rat is less than 0.

Returns the truncated value (toward the nearest integer; 0.5 => 1; -0.5 => -1).

Rational(3).round      #=> 3
Rational(2, 3).round   #=> 1
Rational(-3, 2).round  #=> -2

  #    decimal      -  1  2  3 . 4  5  6
  #                   ^  ^  ^  ^   ^  ^
  #   precision      -3 -2 -1  0  +1 +2

'%f' % Rational('-123.456').round(+1)  #=> "-123.500000"
'%f' % Rational('-123.456').round(-1)  #=> "-120.000000"

Returns the value as a string for inspection.

Rational(2).inspect      #=> "(2/1)"
Rational(-8, 6).inspect  #=> "(-4/3)"
Rational('1/2').inspect  #=> "(1/2)"

Parses the given representation of date and time with the given template, and returns a hash of parsed elements. _strptime does not support specification of flags and width unlike strftime.

Date._strptime('2001-02-03', '%Y-%m-%d')
                          #=> {:year=>2001, :mon=>2, :mday=>3}

See also strptime(3) and strftime.

Parses the given representation of date and time with the given template, and creates a date object. strptime does not support specification of flags and width unlike strftime.

Date.strptime('2001-02-03', '%Y-%m-%d')   #=> #<Date: 2001-02-03 ...>
Date.strptime('03-02-2001', '%d-%m-%Y')   #=> #<Date: 2001-02-03 ...>
Date.strptime('2001-034', '%Y-%j')        #=> #<Date: 2001-02-03 ...>
Date.strptime('2001-W05-6', '%G-W%V-%u')  #=> #<Date: 2001-02-03 ...>
Date.strptime('2001 04 6', '%Y %U %w')    #=> #<Date: 2001-02-03 ...>
Date.strptime('2001 05 6', '%Y %W %u')    #=> #<Date: 2001-02-03 ...>
Date.strptime('sat3feb01', '%a%d%b%y')    #=> #<Date: 2001-02-03 ...>

See also strptime(3) and strftime.

Returns true if the date is Sunday.

Returns the second (0-59).

DateTime.new(2001,2,3,4,5,6).sec          #=> 6

Returns the timezone.

DateTime.parse('04pm+0730').zone          #=> "+07:30"
Search took: 7ms  ·  Total Results: 3509