diff options
author | Xavier Noria <fxn@hashref.com> | 2010-08-10 03:46:21 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-08-10 04:10:32 +0200 |
commit | ae147b45bb4aa2168e104ffc989e42f5c9dbfd80 (patch) | |
tree | 44a7565286b207d0e1a2224a65181bd3b85fb4c1 /railties/guides/source | |
parent | cb9295c8a1c97f07a7a41af420831794fe9c1b35 (diff) | |
download | rails-ae147b45bb4aa2168e104ffc989e42f5c9dbfd80.tar.gz rails-ae147b45bb4aa2168e104ffc989e42f5c9dbfd80.tar.bz2 rails-ae147b45bb4aa2168e104ffc989e42f5c9dbfd80.zip |
AS guide: documents Module#(instance_)method_names
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 672bf750bf..e0c69516cf 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -1066,6 +1066,18 @@ In the previous example the macro generates +User#avatar_size+ rather than +User NOTE: Defined in +active_support/core_ext/module/delegation.rb+ +h4. Method Names + +The builtin methods +instance_methods+ and +methods+ return method names as strings or symbols depending on the Ruby version. Active Support defines +instance_method_names+ and +method_names+ to be equivalent to them, respectively, but always getting strings back. + +For example, +ActionView::Helpers::FormBuilder+ knows this array difference is going to work no matter the Ruby version: + +<ruby> +self.field_helpers = (FormHelper.instance_method_names - ['form_for']) +</ruby> + +NOTE: Defined in +active_support/core_ext/module/method_names.rb+ + h3. Extensions to +Class+ h4. Class Attributes |