Skip to content

Commit

Permalink
removes the compatibility method Module#instance_method_names
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Dec 25, 2011
1 parent 4e1999d commit 40bda76
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
3 changes: 1 addition & 2 deletions actionpack/lib/action_view/helpers/form_helper.rb
Expand Up @@ -5,7 +5,6 @@
require 'action_view/helpers/active_model_helper'
require 'active_support/core_ext/class/attribute'
require 'active_support/core_ext/hash/slice'
require 'active_support/core_ext/module/method_names'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/string/output_safety'
require 'active_support/core_ext/array/extract_options'
Expand Down Expand Up @@ -1232,7 +1231,7 @@ def sanitized_method_name
class FormBuilder
# The methods which wrap a form helper call.
class_attribute :field_helpers
self.field_helpers = FormHelper.instance_method_names - %w(form_for convert_to_model)
self.field_helpers = FormHelper.instance_methods - [:form_for, :convert_to_model]

attr_accessor :object_name, :object, :options

Expand Down
7 changes: 5 additions & 2 deletions activesupport/CHANGELOG.md
@@ -1,7 +1,10 @@
## Rails 4.0.0 (unreleased) ##

* BufferedLogger is deprecated. Use ActiveSupport::Logger, or the logger
from Ruby stdlib.
* Deletes the compatibility method Module#instance_method_names,
use Module#instance_methods from now on (which returns symbols). *fxn*

* BufferedLogger is deprecated. Use ActiveSupport::Logger, or the logger
from Ruby stdlib.

## Rails 3.2.0 (unreleased) ##

Expand Down
@@ -1,8 +1,4 @@
class Module
def instance_method_names(*args)
instance_methods(*args).map { |name| name.to_s }
end

def method_names(*args)
methods(*args).map { |name| name.to_s }
end
Expand Down
Expand Up @@ -937,13 +937,7 @@ 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>
The builtin method +methods+ returns method names as strings or symbols depending on the Ruby version. Active Support defines +method_names+ to be equivalent, but always getting strings back.

NOTE: Defined in +active_support/core_ext/module/method_names.rb+

Expand Down

0 comments on commit 40bda76

Please sign in to comment.