public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
More symbols for send and respond_to?.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
clemens (author)
Tue Sep 02 01:04:53 -0700 2008
jeremy (committer)
Tue Sep 02 15:55:22 -0700 2008
commit  1646e8c36495680756304b23b7301dbda9cad07a
tree    1e8f2ab3f6b889c4ba510c7e9034951f0a9d11fa
parent  a978701f86609020eefae8cb1728ac73904234be
...
26
27
28
29
 
30
31
32
...
26
27
28
 
29
30
31
32
0
@@ -26,7 +26,7 @@ module ActiveModel
0
 
0
         enum = configuration[:in] || configuration[:within]
0
 
0
-        raise(ArgumentError, "An object with the method include? is required must be supplied as the :in option of the configuration hash") unless enum.respond_to?("include?")
0
+        raise(ArgumentError, "An object with the method include? is required must be supplied as the :in option of the configuration hash") unless enum.respond_to?(:include?)
0
 
0
         validates_each(attr_names, configuration) do |record, attr_name, value|
0
           record.errors.add(attr_name, configuration[:message] % value) if enum.include?(value)
...
26
27
28
29
 
30
31
32
...
26
27
28
 
29
30
31
32
0
@@ -26,7 +26,7 @@ module ActiveModel
0
 
0
         enum = configuration[:in] || configuration[:within]
0
 
0
-        raise(ArgumentError, "An object with the method include? is required must be supplied as the :in option of the configuration hash") unless enum.respond_to?("include?")
0
+        raise(ArgumentError, "An object with the method include? is required must be supplied as the :in option of the configuration hash") unless enum.respond_to?(:include?)
0
 
0
         validates_each(attr_names, configuration) do |record, attr_name, value|
0
           record.errors.add(attr_name, configuration[:message] % value) unless enum.include?(value)
...
330
331
332
333
334
 
 
335
336
337
...
330
331
332
 
 
333
334
335
336
337
0
@@ -330,8 +330,8 @@ module ActiveRecord
0
       end
0
     end
0
     
0
-    # A Person object with a name attribute can ask <tt>person.respond_to?("name")</tt>,
0
-    # <tt>person.respond_to?("name=")</tt>, and <tt>person.respond_to?("name?")</tt>
0
+    # A Person object with a name attribute can ask <tt>person.respond_to?(:name)</tt>,
0
+    # <tt>person.respond_to?(:name=)</tt>, and <tt>person.respond_to?(:name?)</tt>
0
     # which will all return +true+.
0
     alias :respond_to_without_attributes? :respond_to?
0
     def respond_to?(method, include_priv = false)
...
54
55
56
57
 
58
59
60
...
751
752
753
754
 
755
756
757
...
785
786
787
788
 
789
790
791
...
54
55
56
 
57
58
59
60
...
751
752
753
 
754
755
756
757
...
785
786
787
 
788
789
790
791
0
@@ -54,7 +54,7 @@ module ActiveRecord
0
     def add_on_empty(attributes, custom_message = nil)
0
       for attr in [attributes].flatten
0
         value = @base.respond_to?(attr.to_s) ? @base.send(attr.to_s) : @base[attr.to_s]
0
-        is_empty = value.respond_to?("empty?") ? value.empty? : false        
0
+        is_empty = value.respond_to?(:empty?) ? value.empty? : false
0
         add(attr, :empty, :default => custom_message) unless !value.nil? && !is_empty
0
       end
0
     end
0
@@ -751,7 +751,7 @@ module ActiveRecord
0
 
0
         enum = configuration[:in] || configuration[:within]
0
 
0
-        raise(ArgumentError, "An object with the method include? is required must be supplied as the :in option of the configuration hash") unless enum.respond_to?("include?")
0
+        raise(ArgumentError, "An object with the method include? is required must be supplied as the :in option of the configuration hash") unless enum.respond_to?(:include?)
0
 
0
         validates_each(attr_names, configuration) do |record, attr_name, value|
0
           unless enum.include?(value)
0
@@ -785,7 +785,7 @@ module ActiveRecord
0
 
0
         enum = configuration[:in] || configuration[:within]
0
 
0
-        raise(ArgumentError, "An object with the method include? is required must be supplied as the :in option of the configuration hash") unless enum.respond_to?("include?")
0
+        raise(ArgumentError, "An object with the method include? is required must be supplied as the :in option of the configuration hash") unless enum.respond_to?(:include?)
0
 
0
         validates_each(attr_names, configuration) do |record, attr_name, value|
0
           if enum.include?(value)
...
915
916
917
918
919
 
 
920
921
922
...
915
916
917
 
 
918
919
920
921
922
0
@@ -915,8 +915,8 @@ module ActiveResource
0
     alias_method :respond_to_without_attributes?, :respond_to?
0
 
0
     # A method to determine if an object responds to a message (e.g., a method call). In Active Resource, a Person object with a
0
-    # +name+ attribute can answer <tt>true</tt> to <tt>my_person.respond_to?("name")</tt>, <tt>my_person.respond_to?("name=")</tt>, and
0
-    # <tt>my_person.respond_to?("name?")</tt>.
0
+    # +name+ attribute can answer <tt>true</tt> to <tt>my_person.respond_to?(:name)</tt>, <tt>my_person.respond_to?(:name=)</tt>, and
0
+    # <tt>my_person.respond_to?(:name?)</tt>.
0
     def respond_to?(method, include_priv = false)
0
       method_name = method.to_s
0
       if attributes.nil?

Comments