to_s

to_s(format = :default) Instance Public methods Also aliased as: to_default_s

usec

usec() Instance Public methods Returns the fraction of a second as microseconds

utc

utc() Instance Public methods Adjusts DateTime to UTC by adding its offset value; offset is set to 0. DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600 DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 +0000 getutc

utc?

utc?() Instance Public methods Returns true if offset == 0.

utc_offset

utc_offset() Instance Public methods Returns the offset value in seconds.

exclude?

exclude?(object) Instance Public methods The negative of the Enumerable#include?. Returns true if the collection does not include the object.

index_by

index_by() Instance Public methods Convert an enumerable to a hash. people.index_by(&:login) => { "nextangle" => <Person ...>, "chade-" => <Person ...>, ...} people.index_by { |person| "#{person.first_name} #{person.last_name}" } => { "Chade- Fowlersburg-e" => <Person ...>, "David Heinemeier Hansson" => <Person ...>, ...}

many?

many?() Instance Public methods Returns true if the enumerable has more than 1 element. Functionally equivalent to enum.to_a.size > 1. Can be called with a block too, much like any?, so people.many? { |p| p.age > 26 } returns true if more than one person is over 26.

sum

sum(identity = 0, &block) Instance Public methods Calculates a sum from the elements. payments.sum { |p| p.price * p.tax_rate } payments.sum(&:price) The latter is a shortcut for: payments.inject(0) { |sum, p| sum + p.price } It can also calculate the sum without the use of a block. [5, 15, 10].sum # => 30 ['foo', 'bar'].sum # => "foobar" [[1, 2], [3, 1, 5]].sum => [1, 2, 3, 1, 5] The default sum of an empty list is zero. You can override this default: [].sum(Pay

h

h(s) Class Public methods Alias for: html_escape