提交 3c6fc589 编写于 作者: M Marcin Olichwirowicz

Rename match_attribute_method? to matched_attribute_method

`match_attribute_method?` is a bit confusing because it suggest
that a return value is a boolean which is not true.
上级 41e7923c
......@@ -342,7 +342,7 @@ def instance_method_already_implemented?(method_name) #:nodoc:
private
# The methods +method_missing+ and +respond_to?+ of this module are
# invoked often in a typical rails, both of which invoke the method
# +match_attribute_method?+. The latter method iterates through an
# +matched_attribute_method+. The latter method iterates through an
# array doing regular expression matches, which results in a lot of
# object creations. Most of the time it returns a +nil+ match. As the
# match result is always the same given a +method_name+, this cache is
......@@ -429,7 +429,7 @@ def method_missing(method, *args, &block)
if respond_to_without_attributes?(method, true)
super
else
match = match_attribute_method?(method.to_s)
match = matched_attribute_method(method.to_s)
match ? attribute_missing(match, *args, &block) : super
end
end
......@@ -454,7 +454,7 @@ def respond_to?(method, include_private_methods = false)
# but found among all methods. Which means that the given method is private.
false
else
!match_attribute_method?(method.to_s).nil?
!matched_attribute_method(method.to_s).nil?
end
end
......@@ -466,7 +466,7 @@ def attribute_method?(attr_name) #:nodoc:
private
# Returns a struct representing the matching attribute method.
# The struct's attributes are prefix, base and suffix.
def match_attribute_method?(method_name)
def matched_attribute_method(method_name)
matches = self.class.send(:attribute_method_matchers_matching, method_name)
matches.detect { |match| attribute_method?(match.attr_name) }
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册