Results for: "pstore"

Registers _filename_ to be loaded (using Kernel::require)
the first time that _const_ (which may be a String or
a symbol) is accessed in the namespace of _mod_.

   module A
   end
   A.autoload(:B, "b")
   A::B.doit            # autoloads "b"

If const in mod is defined as autoload, the file name to be loaded is replaced with filename. If const is defined but not as autoload, does nothing.

Returns filename to be loaded if name is registered as autoload in the namespace of mod or one of its ancestors.

module A
end
A.autoload(:B, "b")
A.autoload?(:B)            #=> "b"

If inherit is false, the lookup only checks the autoloads in the receiver:

class A
  autoload :CONST, "const.rb"
end

class B < A
end

B.autoload?(:CONST)          #=> "const.rb", found in A (ancestor)
B.autoload?(:CONST, false)   #=> nil, not found in B itself

The equivalent of included, but for prepended modules.

module A
  def self.prepended(mod)
    puts "#{self} prepended to #{mod}"
  end
end
module Enumerable
  prepend A
end
 # => prints "A prepended to Enumerable"

Prevents further modifications to mod.

This method returns self.

Returns a string representing this module or class. For basic classes and modules, this is the name. For singletons, we show information on the thing we’re attached to as well.

Returns an array of the names of the constants accessible in mod. This includes the names of constants in any included modules (example at start of section), unless the inherit parameter is set to false.

The implementation makes no guarantees about the order in which the constants are yielded.

IO.constants.include?(:SYNC)        #=> true
IO.constants(false).include?(:SYNC) #=> false

Also see Module#const_defined?.

Returns an Array of two Integer values that represent platform-dependent internal storage properties.

This method is deprecated and will be removed in the future. Instead, use BigDecimal#n_significant_digits for obtaining the number of significant digits in scientific notation, and BigDecimal#precision for obtaining the number of digits in decimal notation.

Returns the number of decimal digits in self:

BigDecimal("0").precision         # => 0
BigDecimal("1").precision         # => 1
BigDecimal("1.1").precision       # => 2
BigDecimal("3.1415").precision    # => 5
BigDecimal("-1e20").precision     # => 21
BigDecimal("1e-20").precision     # => 20
BigDecimal("Infinity").precision  # => 0
BigDecimal("-Infinity").precision # => 0
BigDecimal("NaN").precision       # => 0

Converts the value to a string.

The default format looks like 0.xxxxEnn.

The optional parameter s consists of either an integer; or an optional ‘+’ or ‘ ’, followed by an optional number, followed by an optional ‘E’ or ‘F’.

If there is a ‘+’ at the start of s, positive values are returned with a leading ‘+’.

A space at the start of s returns positive values with a leading space.

If s contains a number, a space is inserted after each group of that many digits, starting from ‘.’ and counting outwards.

If s ends with an ‘E’, engineering notation (0.xxxxEnn) is used.

If s ends with an ‘F’, conventional floating point notation is used.

Examples:

BigDecimal('-1234567890123.45678901234567890').to_s('5F')
  #=> '-123 45678 90123.45678 90123 45678 9'

BigDecimal('1234567890123.45678901234567890').to_s('+8F')
  #=> '+12345 67890123.45678901 23456789'

BigDecimal('1234567890123.45678901234567890').to_s(' F')
  #=> ' 1234567890123.4567890123456789'

Returns the value as an Integer.

If the BigDecimal is infinity or NaN, raises FloatDomainError.

Converts a BigDecimal to a Rational.

Returns the remainder from dividing by the value.

x.remainder(y) means x-y*(x/y).truncate

Returns a new Float object having approximately the same value as the BigDecimal number. Normal accuracy limits and built-in errors of binary Float arithmetic apply.

Return the largest integer less than or equal to the value, as a BigDecimal.

BigDecimal('3.14159').floor #=> 3
BigDecimal('-9.1').floor #=> -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').floor(3) #=> 3.141
BigDecimal('13345.234').floor(-2) #=> 13300.0

Returns self.

require 'bigdecimal/util'

d = BigDecimal("3.14")
d.to_d                       # => 0.314e1

Returns the value as a BigDecimal.

The required precision parameter is used to determine the number of significant digits for the result.

require 'bigdecimal'
require 'bigdecimal/util'

Rational(22, 7).to_d(3)   # => 0.314e1

See also Kernel.BigDecimal.

Returns the largest number less than or equal to rat with a precision of ndigits decimal digits (default: 0).

When the precision is negative, the returned value is an integer with at least ndigits.abs trailing zeros.

Returns a rational when ndigits is positive, otherwise returns an integer.

Rational(3).floor      #=> 3
Rational(2, 3).floor   #=> 0
Rational(-3, 2).floor  #=> -2

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

Rational('-123.456').floor(+1).to_f  #=> -123.5
Rational('-123.456').floor(-1)       #=> -130

Returns the truncated value as an integer.

Equivalent to Rational#truncate.

Rational(2, 3).to_i    #=> 0
Rational(3).to_i       #=> 3
Rational(300.6).to_i   #=> 300
Rational(98, 71).to_i  #=> 1
Rational(-31, 2).to_i  #=> -15

Returns the value as a Float.

Rational(2).to_f      #=> 2.0
Rational(9, 4).to_f   #=> 2.25
Rational(-3, 4).to_f  #=> -0.75
Rational(20, 3).to_f  #=> 6.666666666666667

Returns self.

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

Returns the value as a string.

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

Synonym for $stdin.

Synonym for $stdout.

Returns a new Date object formed fom the arguments.

With no arguments, returns the date for January 1, -4712:

Date.ordinal.to_s # => "-4712-01-01"

With argument year, returns the date for January 1 of that year:

Date.ordinal(2001).to_s  # => "2001-01-01"
Date.ordinal(-2001).to_s # => "-2001-01-01"

With positive argument yday == n, returns the date for the nth day of the given year:

Date.ordinal(2001, 14).to_s # => "2001-01-14"

With negative argument yday, counts backward from the end of the year:

Date.ordinal(2001, -14).to_s # => "2001-12-18"

Raises an exception if yday is zero or out of range.

See argument start.

Related: Date.jd, Date.new.

Returns a new Date object constructed from the present date:

Date.today.to_s # => "2022-07-06"

See argument start.

Search took: 6ms  ·  Total Results: 3855