aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/active_support_core_extensions.textile
diff options
context:
space:
mode:
authorGonçalo Silva <goncalossilva@gmail.com>2011-04-17 17:08:49 +0100
committerGonçalo Silva <goncalossilva@gmail.com>2011-04-17 17:08:49 +0100
commit1c2b2233c3a7ec76c0a0eddf5b8be45c489be133 (patch)
tree56f2b767c3a4f1f14c51606bf2cbb714a98c5f89 /railties/guides/source/active_support_core_extensions.textile
parent8d558cb1b069410c8f693295c9c4e2ffc9661e06 (diff)
parentb6843f22ac42b503f6b8ac00105ca0679049be7d (diff)
downloadrails-1c2b2233c3a7ec76c0a0eddf5b8be45c489be133.tar.gz
rails-1c2b2233c3a7ec76c0a0eddf5b8be45c489be133.tar.bz2
rails-1c2b2233c3a7ec76c0a0eddf5b8be45c489be133.zip
Merge branch 'master' of https://github.com/rails/rails into performance_test
Diffstat (limited to 'railties/guides/source/active_support_core_extensions.textile')
-rw-r--r--railties/guides/source/active_support_core_extensions.textile22
1 files changed, 22 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile
index 788f528654..3ba840c044 100644
--- a/railties/guides/source/active_support_core_extensions.textile
+++ b/railties/guides/source/active_support_core_extensions.textile
@@ -442,6 +442,28 @@ require_library_or_gem('mysql')
NOTE: Defined in +active_support/core_ext/kernel/requires.rb+.
+h4. +in?+ and +either?+
+
+The predicate +in?+ tests if an object is included in another object, and the predicate +either?+ tests if an object is included in a list of objects which will be passed as arguments.
+
+Examples of +in?+:
+
+<ruby>
+ 1.in?([1,2]) # => true
+ "lo".in?("hello") # => true
+ 25.in?(30..50) # => false
+</ruby>
+
+Examples of +either?+:
+
+<ruby>
+ 1.either?(1,2,3) # => true
+ 5.either?(1,2,3) # => false
+ [1,2,3].either?([1,2,3], 2, [3,4,5]) # => true
+</ruby>
+
+NOTE: Defined in +active_support/core_ext/object/inclusion.rb+.
+
h3. Extensions to +Module+
h4. +alias_method_chain+