aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-03-23 00:19:17 +0100
committerXavier Noria <fxn@hashref.com>2010-03-23 00:19:17 +0100
commit926ff0e0a141e27589b4f5c83e168b10a9ac0a54 (patch)
tree7813b23a948c26bef07a0f4e357b61f251f818c1 /railties
parentdea701bd2c6369cd1928b2bb9ff8f17a38fa0c73 (diff)
downloadrails-926ff0e0a141e27589b4f5c83e168b10a9ac0a54.tar.gz
rails-926ff0e0a141e27589b4f5c83e168b10a9ac0a54.tar.bz2
rails-926ff0e0a141e27589b4f5c83e168b10a9ac0a54.zip
AS guide: documents Module#remove_possible_method
Diffstat (limited to 'railties')
-rw-r--r--railties/guides/source/active_support_core_extensions.textile19
1 files changed, 19 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile
index db28e07642..0a9374e028 100644
--- a/railties/guides/source/active_support_core_extensions.textile
+++ b/railties/guides/source/active_support_core_extensions.textile
@@ -799,6 +799,25 @@ end
NOTE: Defined in +active_support/core_ext/module/delegation.rb+.
+h4. Method Removal
+
+h5. +remove_possible_method+
+
+The method +remove_possible_method+ is like the standard +remove_method+, except it silently returns on failure:
+
+<ruby>
+class A; end
+
+A.class_eval do
+ remove_method(:nonexistent) # raises NameError
+ remove_possible_method(:nonexistent) # no problem, continue
+end
+</ruby>
+
+This may come in handy if you need to define a method that may already exist, since redefining a method issues a warning "method redefined; discarding old redefined_method_name".
+
+NOTE: Defined in +active_support/core_ext/module/remove_method.rb+.
+
h4. Parents
h5. +parent+