From dcee094b22891a95b69e0c14a963b2f857bfecd0 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 24 Apr 2011 02:17:06 +0530 Subject: indentation fixes --- .../guides/source/active_support_core_extensions.textile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'railties/guides/source/active_support_core_extensions.textile') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index f89c83e4cd..7bda1760a9 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -449,9 +449,9 @@ The predicate +in?+ tests if an object is included in another object. An +Argume Examples of +in?+: - 1.in?([1,2]) # => true - "lo".in?("hello") # => true - 25.in?(30..50) # => false +1.in?([1,2]) # => true +"lo".in?("hello") # => true +25.in?(30..50) # => false NOTE: Defined in +active_support/core_ext/object/inclusion.rb+. @@ -541,9 +541,9 @@ The default value can be also specified with a block, which is called in the con class User attr_accessor :name, :surname - attr_accessor_with_default(:full_name) { - [name, surname].compact.join(" ") - } + attr_accessor_with_default(:full_name) do + [name, surname].compact.join(" ") + end end u = User.new @@ -1223,7 +1223,7 @@ NOTE: Defined in +active_support/core_ext/string/output_safety.rb+. h4. +squish+ -The method +String#squish+ strips leading and trailing whitespace, and substitutes runs of whitespace with a single space each: +The method +squish+ strips leading and trailing whitespace, and substitutes runs of whitespace with a single space each: " \n foo\n\r \t bar \n".squish # => "foo bar" -- cgit v1.2.3 From 089ee31aadd881a59ad60b6dcb406600dc331bfd Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 27 Apr 2011 22:21:50 +0530 Subject: update the Array#from behaviour changes - returns [] if index exceeds array length --- railties/guides/source/active_support_core_extensions.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/guides/source/active_support_core_extensions.textile') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 7bda1760a9..f2170e120b 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -1996,11 +1996,11 @@ Active Support augments the API of arrays to ease certain ways of accessing them [].to(7) # => [] -Similarly, +from+ returns the tail from the element at the passed index on: +Similarly, +from+ returns the tail from the element at the passed index to the end. If the index is greater than the length of the array, it returns an empty array. %w(a b c d).from(2) # => %w(c d) -%w(a b c d).from(10) # => nil +%w(a b c d).from(10) # => [] [].from(0) # => [] -- cgit v1.2.3