Results for: "minmax"

Invokes Module.append_features on each parameter in reverse order.

Refine mod in the receiver.

Returns a module, where refined methods are defined.

Import class refinements from module into the current class or module definition.

Returns the list of Modules nested at the point of call.

module M1
  module M2
    $a = Module.nesting
  end
end
$a           #=> [M1::M2, M1]
$a[0].name   #=> "M1::M2"

Callback invoked whenever the receiver is included in another module or class. This should be used in preference to Module.append_features if your code wants to perform some action when a module is included in another.

module A
  def A.included(mod)
    puts "#{self} included in #{mod}"
  end
end
module Enumerable
  include A
end
 # => prints "A included in Enumerable"

Returns true if module is included in mod or one of mod’s ancestors.

module A
end
class B
  include A
end
class C < B
end
B.include?(A)   #=> true
C.include?(A)   #=> true
A.include?(A)   #=> false

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.

Limit the number of significant digits in newly created BigDecimal numbers to the specified value. Rounding is performed as necessary, as specified by BigDecimal.mode.

A limit of 0, the default, means no upper limit.

The limit specified by this method takes less priority over any limit specified to instance methods such as ceil, floor, truncate, or round.

Returns a string representation of self.

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

Returns True if the value is finite (not NaN or infinite).

Returns the absolute value of rat.

(1/2r).abs    #=> (1/2)
(-1/2r).abs   #=> (1/2)

Rational#magnitude is an alias for Rational#abs.

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)"

Creates a date object denoting the given ordinal date.

The day of year should be a negative or a positive number (as a relative day from the end of year when negative). It should not be zero.

Date.ordinal(2001)        #=> #<Date: 2001-01-01 ...>
Date.ordinal(2001,34)     #=> #<Date: 2001-02-03 ...>
Date.ordinal(2001,-1)     #=> #<Date: 2001-12-31 ...>

See also ::jd and ::new.

Returns a hash of parsed elements.

Raise an ArgumentError when the string length is longer than limit. You can stop this check by passing ‘limit: nil`, but note that it may take a long time to parse.

Creates a new Date object by parsing from a string according to some typical XML Schema formats.

Date.xmlschema('2001-02-03')      #=> #<Date: 2001-02-03 ...>

Raise an ArgumentError when the string length is longer than limit. You can stop this check by passing ‘limit: nil`, but note that it may take a long time to parse.

Returns the value as a string for inspection.

Date.new(2001,2,3).inspect
          #=> "#<Date: 2001-02-03 ((2451944j,0s,0n),+0s,2299161j)>"
DateTime.new(2001,2,3,4,5,6,'-7').inspect
          #=> "#<DateTime: 2001-02-03T04:05:06-07:00 ((2451944j,39906s,0n),-25200s,2299161j)>"

This method is equivalent to strftime(‘%F’).

Creates a DateTime object denoting the given ordinal date.

DateTime.ordinal(2001,34) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
DateTime.ordinal(2001,34,4,5,6,'+7')
                          #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
DateTime.ordinal(2001,-332,-20,-55,-54,'+7')
                          #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>

Creates a new DateTime object by parsing from a string according to some typical XML Schema formats.

DateTime.xmlschema('2001-02-03T04:05:06+07:00')
                          #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>

Raise an ArgumentError when the string length is longer than limit. You can stop this check by passing ‘limit: nil`, but note that it may take a long time to parse.

This method is equivalent to strftime(‘%FT%T%:z’). The optional argument n is the number of digits for fractional seconds.

DateTime.parse('2001-02-03T04:05:06.123456789+07:00').iso8601(9)
                          #=> "2001-02-03T04:05:06.123456789+07:00"

Parses date as a dateTime defined by the XML Schema and converts it to a Time object. The format is a restricted version of the format defined by ISO 8601.

ArgumentError is raised if date is not compliant with the format or if the Time class cannot represent specified date.

See xmlschema for more information on this format.

require 'time'

Time.xmlschema("2011-10-05T22:26:12-04:00")
#=> 2011-10-05 22:26:12-04:00

You must require ‘time’ to use this method.

Returns a string which represents the time as a dateTime defined by XML Schema:

CCYY-MM-DDThh:mm:ssTZD
CCYY-MM-DDThh:mm:ss.sssTZD

where TZD is Z or [+-]hh:mm.

If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.

fractional_digits specifies a number of digits to use for fractional seconds. Its default value is 0.

require 'time'

t = Time.now
t.iso8601  # => "2011-10-05T22:26:12-04:00"

You must require ‘time’ to use this method.

Returns a string representing time. Equivalent to calling strftime with the appropriate format string.

t = Time.now
t.to_s                              #=> "2012-11-10 18:16:12 +0100"
t.strftime "%Y-%m-%d %H:%M:%S %z"   #=> "2012-11-10 18:16:12 +0100"

t.utc.to_s                          #=> "2012-11-10 17:16:12 UTC"
t.strftime "%Y-%m-%d %H:%M:%S UTC"  #=> "2012-11-10 17:16:12 UTC"

Returns a Hash (not a DBM database) created by using each value in the database as a key, with the corresponding key as its value.

Returns true if the database contains the specified key, false otherwise.

Search took: 4ms  ·  Total Results: 1972