html_escape_once

html_escape_once(s) Class Public methods A utility method for escaping HTML without affecting existing escaped entities. html_escape_once('1 < 2 &amp; 3') # => "1 &lt; 2 &amp; 3" html_escape_once('&lt;&lt; Accept & Checkout') # => "&lt;&lt; Accept &amp; Checkout"

html_escape

html_escape(s) Class Public methods A utility method for escaping HTML tag characters. This method is also aliased as h. In your ERB templates, use this method to escape any unsafe content. For example: <%=h @person.name %> puts html_escape('is a > 0 & a < 10?') # => is a &gt; 0 &amp; a &lt; 10? h

h

h(s) Class Public methods Alias for: html_escape

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

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.

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 ...>, ...}

exclude?

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

utc_offset

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

utc?

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

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