From 7a1189a2c75b16f86a11c1d2379c50b11a7a2d66 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 11 Apr 2011 20:09:22 -0300 Subject: Updated AS guide with new Object#in? and Object#either? methods --- .../source/active_support_core_extensions.textile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (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 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?+: + + + 1.in?([1,2]) # => true + "lo".in?("hello") # => true + 25.in?(30..50) # => false + + +Examples of +either?+: + + + 1.either?(1,2,3) # => true + 5.either?(1,2,3) # => false + [1,2,3].either?([1,2,3], 2, [3,4,5]) # => true + + +NOTE: Defined in +active_support/core_ext/object/inclusion.rb+. + h3. Extensions to +Module+ h4. +alias_method_chain+ -- cgit v1.2.3