public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Get rid of 'Object#send!'. It was originally added because it's in Ruby 1.9, but 
it has since been removed from 1.9.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>

Conflicts:

  actionpack/test/controller/layout_test.rb
jeremy (author)
Sun Aug 31 13:15:26 -0700 2008
commit  a1eb4e11c2cccb91483fa15f1a1a0b2ae518d2cf
tree    ef09df0f7118b04e8964753b83499ccf027bba1a
parent  e9a8e0053be3b293ab89fb584f1d660063f107aa
...
72
73
74
75
 
76
77
78
...
92
93
94
95
 
96
97
98
...
72
73
74
 
75
76
77
78
...
92
93
94
 
95
96
97
98
0
@@ -72,7 +72,7 @@ module ActionMailer
0
         methods.flatten.each do |method|
0
           master_helper_module.module_eval <<-end_eval
0
             def #{method}(*args, &block)
0
-              controller.send!(%(#{method}), *args, &block)
0
+              controller.__send__(%(#{method}), *args, &block)
0
             end
0
           end_eval
0
         end
0
@@ -92,7 +92,7 @@ module ActionMailer
0
           inherited_without_helper(child)
0
           begin
0
             child.master_helper_module = Module.new
0
-            child.master_helper_module.send! :include, master_helper_module
0
+            child.master_helper_module.__send__(:include, master_helper_module)
0
             child.helper child.name.to_s.underscore
0
           rescue MissingSourceFile => e
0
             raise unless e.is_missing?("helpers/#{child.name.to_s.underscore}_helper")
...
90
91
92
93
 
94
95
96
...
90
91
92
 
93
94
95
96
0
@@ -90,7 +90,7 @@ module ActionController #:nodoc:
0
             set_content_type!(controller, cache_path.extension)
0
             options = { :text => cache }
0
             options.merge!(:layout => true) if cache_layout?
0
-            controller.send!(:render, options)
0
+            controller.__send__(:render, options)
0
             false
0
           else
0
             controller.action_cache_path = cache_path
...
83
84
85
86
87
 
 
88
89
90
91
92
 
93
94
95
...
83
84
85
 
 
86
87
88
89
90
91
 
92
93
94
95
0
@@ -83,13 +83,13 @@ module ActionController #:nodoc:
0
             controller_callback_method_name = "#{timing}_#{controller.controller_name.underscore}"
0
             action_callback_method_name     = "#{controller_callback_method_name}_#{controller.action_name}"
0
 
0
-            send!(controller_callback_method_name) if respond_to?(controller_callback_method_name, true)
0
-            send!(action_callback_method_name)     if respond_to?(action_callback_method_name, true)
0
+            __send__(controller_callback_method_name) if respond_to?(controller_callback_method_name, true)
0
+            __send__(action_callback_method_name)     if respond_to?(action_callback_method_name, true)
0
           end
0
 
0
           def method_missing(method, *arguments)
0
             return if @controller.nil?
0
-            @controller.send!(method, *arguments)
0
+            @controller.__send__(method, *arguments)
0
           end
0
       end
0
     end
...
48
49
50
51
 
52
53
54
...
107
108
109
110
 
111
112
113
...
164
165
166
167
 
168
169
170
...
48
49
50
 
51
52
53
54
...
107
108
109
 
110
111
112
113
...
164
165
166
 
167
168
169
170
0
@@ -48,7 +48,7 @@ module ActionController #:nodoc:
0
     def initialize(cgi, session_options = {})
0
       @cgi = cgi
0
       @session_options = session_options
0
-      @env = @cgi.send!(:env_table)
0
+      @env = @cgi.__send__(:env_table)
0
       super()
0
     end
0
 
0
@@ -107,7 +107,7 @@ module ActionController #:nodoc:
0
     end
0
 
0
     def method_missing(method_id, *arguments)
0
-      @cgi.send!(method_id, *arguments) rescue super
0
+      @cgi.__send__(method_id, *arguments) rescue super
0
     end
0
 
0
     private
0
@@ -164,7 +164,7 @@ end_msg
0
       begin
0
         output.write(@cgi.header(@headers))
0
 
0
-        if @cgi.send!(:env_table)['REQUEST_METHOD'] == 'HEAD'
0
+        if @cgi.__send__(:env_table)['REQUEST_METHOD'] == 'HEAD'
0
           return
0
         elsif @body.respond_to?(:call)
0
           # Flush the output now in case the @body Proc uses
...
65
66
67
68
 
69
70
71
...
65
66
67
 
68
69
70
71
0
@@ -65,7 +65,7 @@ module ActionController #:nodoc:
0
 
0
     module HelperMethods
0
       def render_component(options)
0
-        @controller.send!(:render_component_as_string, options)
0
+        @controller.__send__(:render_component_as_string, options)
0
       end
0
     end
0
 
...
199
200
201
202
203
 
 
204
205
206
...
223
224
225
226
227
 
 
228
229
230
...
199
200
201
 
 
202
203
204
205
206
...
223
224
225
 
 
226
227
228
229
230
0
@@ -199,8 +199,8 @@ module ActionController #:nodoc:
0
           Proc.new do |controller, action|
0
             method.before(controller)
0
 
0
-            if controller.send!(:performed?)
0
-              controller.send!(:halt_filter_chain, method, :rendered_or_redirected)
0
+            if controller.__send__(:performed?)
0
+              controller.__send__(:halt_filter_chain, method, :rendered_or_redirected)
0
             else
0
               begin
0
                 action.call
0
@@ -223,8 +223,8 @@ module ActionController #:nodoc:
0
 
0
       def call(controller, &block)
0
         super
0
-        if controller.send!(:performed?)
0
-          controller.send!(:halt_filter_chain, method, :rendered_or_redirected)
0
+        if controller.__send__(:performed?)
0
+          controller.__send__(:halt_filter_chain, method, :rendered_or_redirected)
0
         end
0
       end
0
     end
...
204
205
206
207
208
 
 
209
210
211
...
204
205
206
 
 
207
208
209
210
211
0
@@ -204,8 +204,8 @@ module ActionController #:nodoc:
0
 
0
           begin
0
             child.master_helper_module = Module.new
0
-            child.master_helper_module.send! :include, master_helper_module
0
-            child.send! :default_helper_module!
0
+            child.master_helper_module.__send__ :include, master_helper_module
0
+            child.__send__ :default_helper_module!
0
           rescue MissingSourceFile => e
0
             raise unless e.is_missing?("helpers/#{child.controller_path}_helper")
0
           end
...
117
118
119
120
 
121
122
123
...
117
118
119
 
120
121
122
123
0
@@ -117,7 +117,7 @@ module ActionController
0
 
0
       def authentication_request(controller, realm)
0
         controller.headers["WWW-Authenticate"] = %(Basic realm="#{realm.gsub(/"/, "")}")
0
-        controller.send! :render, :text => "HTTP Basic: Access denied.\n", :status => :unauthorized
0
+        controller.__send__ :render, :text => "HTTP Basic: Access denied.\n", :status => :unauthorized
0
       end
0
     end
0
   end
...
444
445
446
447
 
448
449
450
...
469
470
471
472
 
473
474
475
476
477
 
478
479
480
...
488
489
490
491
 
492
493
494
...
444
445
446
 
447
448
449
450
...
469
470
471
 
472
473
474
475
476
 
477
478
479
480
...
488
489
490
 
491
492
493
494
0
@@ -444,7 +444,7 @@ EOF
0
           reset! unless @integration_session
0
           # reset the html_document variable, but only for new get/post calls
0
           @html_document = nil unless %w(cookies assigns).include?(method)
0
-          returning @integration_session.send!(method, *args) do
0
+          returning @integration_session.__send__(method, *args) do
0
             copy_session_variables!
0
           end
0
         end
0
@@ -469,12 +469,12 @@ EOF
0
           self.class.fixture_table_names.each do |table_name|
0
             name = table_name.tr(".", "_")
0
             next unless respond_to?(name)
0
-            extras.send!(:define_method, name) { |*args| delegate.send(name, *args) }
0
+            extras.__send__(:define_method, name) { |*args| delegate.send(name, *args) }
0
           end
0
         end
0
 
0
         # delegate add_assertion to the test case
0
-        extras.send!(:define_method, :add_assertion) { test_result.add_assertion }
0
+        extras.__send__(:define_method, :add_assertion) { test_result.add_assertion }
0
         session.extend(extras)
0
         session.delegate = self
0
         session.test_result = @_result
0
@@ -488,7 +488,7 @@ EOF
0
       def copy_session_variables! #:nodoc:
0
         return unless @integration_session
0
         %w(controller response request).each do |var|
0
-          instance_variable_set("@#{var}", @integration_session.send!(var))
0
+          instance_variable_set("@#{var}", @integration_session.__send__(var))
0
         end
0
       end
0
 
...
219
220
221
222
 
223
224
225
...
238
239
240
241
 
242
243
244
...
247
248
249
250
 
251
252
253
...
272
273
274
275
 
276
277
278
...
219
220
221
 
222
223
224
225
...
238
239
240
 
241
242
243
244
...
247
248
249
 
250
251
252
253
...
272
273
274
 
275
276
277
278
0
@@ -219,7 +219,7 @@ module ActionController #:nodoc:
0
       layout = passed_layout || self.class.default_layout(default_template_format)
0
       active_layout = case layout
0
         when String then layout
0
-        when Symbol then send!(layout)
0
+        when Symbol then __send__(layout)
0
         when Proc   then layout.call(self)
0
       end
0
 
0
@@ -238,7 +238,7 @@ module ActionController #:nodoc:
0
     private
0
       def candidate_for_layout?(options)
0
         options.values_at(:text, :xml, :json, :file, :inline, :partial, :nothing, :update).compact.empty? &&
0
-          !@template.send(:_exempt_from_layout?, options[:template] || default_template_name(options[:action]))
0
+          !@template.__send__(:_exempt_from_layout?, options[:template] || default_template_name(options[:action]))
0
       end
0
 
0
       def pick_layout(options)
0
@@ -247,7 +247,7 @@ module ActionController #:nodoc:
0
           when FalseClass
0
             nil
0
           when NilClass, TrueClass
0
-            active_layout if action_has_layout? && !@template.send(:_exempt_from_layout?, default_template_name)
0
+            active_layout if action_has_layout? && !@template.__send__(:_exempt_from_layout?, default_template_name)
0
           else
0
             active_layout(layout)
0
           end
0
@@ -272,7 +272,7 @@ module ActionController #:nodoc:
0
       end
0
 
0
       def layout_directory?(layout_name)
0
-        @template.send(:_pick_template, "#{File.join('layouts', layout_name)}.#{@template.template_format}") ? true : false
0
+        @template.__send__(:_pick_template, "#{File.join('layouts', layout_name)}.#{@template.template_format}") ? true : false
0
       rescue ActionView::MissingTemplate
0
         false
0
       end
...
108
109
110
111
 
112
113
114
...
149
150
151
152
 
153
154
155
...
157
158
159
160
 
161
162
163
...
108
109
110
 
111
112
113
114
...
149
150
151
 
152
153
154
155
...
157
158
159
 
160
161
162
163
0
@@ -108,7 +108,7 @@ module ActionController
0
         args.last.kind_of?(Hash) ? args.last.merge!(url_options) : args << url_options
0
       end
0
 
0
-      send!(named_route, *args)
0
+      __send__(named_route, *args)
0
     end
0
 
0
     # Returns the path component of a URL for the given record. It uses
0
@@ -149,7 +149,7 @@ module ActionController
0
             if parent.is_a?(Symbol) || parent.is_a?(String)
0
               string << "#{parent}_"
0
             else
0
-              string << "#{RecordIdentifier.send!("singular_class_name", parent)}_"
0
+              string << "#{RecordIdentifier.__send__("singular_class_name", parent)}_"
0
             end
0
           end
0
         end
0
@@ -157,7 +157,7 @@ module ActionController
0
         if record.is_a?(Symbol) || record.is_a?(String)
0
           route << "#{record}_"
0
         else
0
-          route << "#{RecordIdentifier.send!("#{inflection}_class_name", record)}_"
0
+          route << "#{RecordIdentifier.__send__("#{inflection}_class_name", record)}_"
0
         end
0
 
0
         action_prefix(options) + namespace + route + routing_type(options).to_s
...
115
116
117
118
 
119
120
121
...
353
354
355
356
 
357
358
359
...
361
362
363
364
 
365
366
367
...
115
116
117
 
118
119
120
121
...
353
354
355
 
356
357
358
359
...
361
362
363
 
364
365
366
367
0
@@ -115,7 +115,7 @@ module ActionController
0
         def install(destinations = [ActionController::Base, ActionView::Base], regenerate = false)
0
           reset! if regenerate
0
           Array(destinations).each do |dest|
0
-            dest.send! :include, @module
0
+            dest.__send__(:include, @module)
0
           end
0
         end
0
 
0
@@ -353,7 +353,7 @@ module ActionController
0
           if generate_all
0
             # Used by caching to expire all paths for a resource
0
             return routes.collect do |route|
0
-              route.send!(method, options, merged, expire_on)
0
+              route.__send__(method, options, merged, expire_on)
0
             end.compact
0
           end
0
 
0
@@ -361,7 +361,7 @@ module ActionController
0
           routes = routes_by_controller[controller][action][options.keys.sort_by { |x| x.object_id }]
0
 
0
           routes.each do |route|
0
-            results = route.send!(method, options, merged, expire_on)
0
+            results = route.__send__(method, options, merged, expire_on)
0
             return results if results && (!results.is_a?(Array) || results.first)
0
           end
0
         end
...
357
358
359
360
 
361
362
363
...
403
404
405
406
 
407
408
409
...
436
437
438
439
 
440
441
442
...
357
358
359
 
360
361
362
363
...
403
404
405
 
406
407
408
409
...
436
437
438
 
439
440
441
442
0
@@ -357,7 +357,7 @@ module ActionController #:nodoc:
0
     alias local_path path
0
 
0
     def method_missing(method_name, *args, &block) #:nodoc:
0
-      @tempfile.send!(method_name, *args, &block)
0
+      @tempfile.__send__(method_name, *args, &block)
0
     end
0
   end
0
 
0
@@ -403,7 +403,7 @@ module ActionController #:nodoc:
0
     def xml_http_request(request_method, action, parameters = nil, session = nil, flash = nil)
0
       @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
0
       @request.env['HTTP_ACCEPT'] = 'text/javascript, text/html, application/xml, text/xml, */*'
0
-      returning send!(request_method, action, parameters, session, flash) do
0
+      returning __send__(request_method, action, parameters, session, flash) do
0
         @request.env.delete 'HTTP_X_REQUESTED_WITH'
0
         @request.env.delete 'HTTP_ACCEPT'
0
       end
0
@@ -436,7 +436,7 @@ module ActionController #:nodoc:
0
 
0
     def build_request_uri(action, parameters)
0
       unless @request.env['REQUEST_URI']
0
-        options = @controller.send!(:rewrite_options, parameters)
0
+        options = @controller.__send__(:rewrite_options, parameters)
0
         options.update(:only_path => true, :action => action)
0
 
0
         url = ActionController::UrlRewriter.new(@request, parameters)
...
80
81
82
83
 
84
85
86
...
116
117
118
119
 
120
121
122
...
80
81
82
 
83
84
85
86
...
116
117
118
 
119
120
121
122
0
@@ -80,7 +80,7 @@ module ActionController #:nodoc:
0
       #   array (may also be a single value).
0
       def verify(options={})
0
         before_filter :only => options[:only], :except => options[:except] do |c|
0
-          c.send! :verify_action, options
0
+          c.__send__ :verify_action, options
0
         end
0
       end
0
     end
0
@@ -116,7 +116,7 @@ module ActionController #:nodoc:
0
     end
0
     
0
     def apply_redirect_to(redirect_to_option) # :nodoc:
0
-      (redirect_to_option.is_a?(Symbol) && redirect_to_option != :back) ? self.send!(redirect_to_option) : redirect_to_option
0
+      (redirect_to_option.is_a?(Symbol) && redirect_to_option != :back) ? self.__send__(redirect_to_option) : redirect_to_option
0
     end
0
     
0
     def apply_remaining_actions(options) # :nodoc:
...
54
55
56
57
 
58
59
60
...
54
55
56
 
57
58
59
60
0
@@ -54,7 +54,7 @@ module ActionView
0
     private
0
       def method_missing(selector, *args)
0
         controller = TestController.new
0
-        return controller.send!(selector, *args) if ActionController::Routing::Routes.named_routes.helpers.include?(selector)
0
+        return controller.__send__(selector, *args) if ActionController::Routing::Routes.named_routes.helpers.include?(selector)
0
         super
0
       end
0
   end
...
84
85
86
87
 
88
89
90
91
 
92
93
94
...
100
101
102
103
 
104
105
106
...
140
141
142
143
 
144
145
146
...
84
85
86
 
87
88
89
90
 
91
92
93
94
...
100
101
102
 
103
104
105
106
...
140
141
142
 
143
144
145
146
0
@@ -84,11 +84,11 @@ class ControllerInstanceTests < Test::Unit::TestCase
0
   def test_action_methods
0
     @empty_controllers.each do |c|
0
       hide_mocha_methods_from_controller(c)
0
-      assert_equal Set.new, c.send!(:action_methods), "#{c.controller_path} should be empty!"
0
+      assert_equal Set.new, c.__send__(:action_methods), "#{c.controller_path} should be empty!"
0
     end
0
     @non_empty_controllers.each do |c|
0
       hide_mocha_methods_from_controller(c)
0
-      assert_equal Set.new(%w(public_action)), c.send!(:action_methods), "#{c.controller_path} should not be empty!"
0
+      assert_equal Set.new(%w(public_action)), c.__send__(:action_methods), "#{c.controller_path} should not be empty!"
0
     end
0
   end
0
 
0
@@ -100,7 +100,7 @@ class ControllerInstanceTests < Test::Unit::TestCase
0
         :expects, :mocha, :mocha_inspect, :reset_mocha, :stubba_object,
0
         :stubba_method, :stubs, :verify, :__metaclass__, :__is_a__, :to_matcher,
0
       ]
0
-      controller.class.send!(:hide_action, *mocha_methods)
0
+      controller.class.__send__(:hide_action, *mocha_methods)
0
     end
0
 end
0
 
0
@@ -140,7 +140,7 @@ class PerformActionTest < Test::Unit::TestCase
0
   
0
   def test_method_missing_is_not_an_action_name
0
     use_controller MethodMissingController
0
-    assert ! @controller.send!(:action_methods).include?('method_missing')
0
+    assert ! @controller.__send__(:action_methods).include?('method_missing')
0
     
0
     get :method_missing
0
     assert_response :success
...
27
28
29
30
 
31
32
33
...
37
38
39
40
 
41
42
43
...
27
28
29
 
30
31
32
33
...
37
38
39
 
40
41
42
43
0
@@ -27,7 +27,7 @@ class FilterParamTest < Test::Unit::TestCase
0
 
0
     test_hashes.each do |before_filter, after_filter, filter_words|
0
       FilterParamController.filter_parameter_logging(*filter_words)
0
-      assert_equal after_filter, @controller.send!(:filter_parameters, before_filter)
0
+      assert_equal after_filter, @controller.__send__(:filter_parameters, before_filter)
0
 
0
       filter_words.push('blah')
0
       FilterParamController.filter_parameter_logging(*filter_words) do |key, value|
0
@@ -37,7 +37,7 @@ class FilterParamTest < Test::Unit::TestCase
0
       before_filter['barg'] = {'bargain'=>'gain', 'blah'=>'bar', 'bar'=>{'bargain'=>{'blah'=>'foo'}}}
0
       after_filter['barg'] = {'bargain'=>'niag', 'blah'=>'[FILTERED]', 'bar'=>{'bargain'=>{'blah'=>'[FILTERED]'}}}
0
 
0
-      assert_equal after_filter, @controller.send!(:filter_parameters, before_filter)
0
+      assert_equal after_filter, @controller.__send__(:filter_parameters, before_filter)
0
     end
0
   end
0
 
...
364
365
366
367
 
368
369
370
...
364
365
366
 
367
368
369
370
0
@@ -364,7 +364,7 @@ class FilterTest < Test::Unit::TestCase
0
       begin
0
         yield
0
       rescue ErrorToRescue => ex
0
-        controller.send! :render, :text => "I rescued this: #{ex.inspect}"
0
+        controller.__send__ :render, :text => "I rescued this: #{ex.inspect}"
0
       end
0
     end
0
   end
...
243
244
245
246
 
247
248
249
...
243
244
245
 
246
247
248
249
0
@@ -243,7 +243,7 @@ class IntegrationTestUsesCorrectClass < ActionController::IntegrationTest
0
     reset!
0
     stub_integration_session(@integration_session)
0
     %w( get post head put delete ).each do |verb|
0
-      assert_nothing_raised("'#{verb}' should use integration test methods") { send!(verb, '/') }
0
+      assert_nothing_raised("'#{verb}' should use integration test methods") { __send__(verb, '/') }
0
     end
0
   end
0
 end
...
4
5
6
7
 
8
9
10
...
4
5
6
 
7
8
9
10
0
@@ -4,7 +4,7 @@ module ActiveModel
0
   module Validations
0
     def self.included(base) # :nodoc:
0
       base.extend(ClassMethods)
0
-      base.send!(:include, ActiveSupport::Callbacks)
0
+      base.__send__(:include, ActiveSupport::Callbacks)
0
       base.define_callbacks :validate, :validate_on_create, :validate_on_update
0
     end
0
 
...
1012
1013
1014
1015
 
1016
1017
1018
...
1012
1013
1014
 
1015
1016
1017
1018
0
@@ -1012,7 +1012,7 @@ module ActiveResource
0
       end
0
 
0
       def split_options(options = {})
0
-        self.class.send!(:split_options, options)
0
+        self.class.__send__(:split_options, options)
0
       end
0
 
0
       def method_missing(method_symbol, *arguments) #:nodoc:
...
109
110
111
112
 
113
114
115
116
 
117
118
119
...
109
110
111
 
112
113
114
115
 
116
117
118
119
0
@@ -109,11 +109,11 @@ module ActiveResource
0
 
0
       private
0
         def custom_method_element_url(method_name, options = {})
0
-          "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{id}/#{method_name}.#{self.class.format.extension}#{self.class.send!(:query_string, options)}"
0
+          "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{id}/#{method_name}.#{self.class.format.extension}#{self.class.__send__(:query_string, options)}"
0
         end
0
 
0
         def custom_method_new_element_url(method_name, options = {})
0
-          "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/new/#{method_name}.#{self.class.format.extension}#{self.class.send!(:query_string, options)}"
0
+          "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/new/#{method_name}.#{self.class.format.extension}#{self.class.__send__(:query_string, options)}"
0
         end
0
     end
0
   end
...
19
20
21
22
 
23
24
25
...
29
30
31
32
 
33
34
35
...
38
39
40
41
 
42
43
44
...
47
48
49
50
 
51
52
53
...
58
59
60
61
 
62
63
64
...
69
70
71
72
 
73
74
75
...
79
80
81
82
 
83
84
85
...
116
117
118
119
 
120
121
122
...
19
20
21
 
22
23
24
25
...
29
30
31
 
32
33
34
35
...
38
39
40
 
41
42
43
44
...
47
48
49
 
50
51
52
53
...
58
59
60
 
61
62
63
64
...
69
70
71
 
72
73
74
75
...
79
80
81
 
82
83
84
85
...
116
117
118
 
119
120
121
122
0
@@ -19,7 +19,7 @@ class AuthorizationTest < Test::Unit::TestCase
0
   end
0
 
0
   def test_authorization_header
0
-    authorization_header = @authenticated_conn.send!(:authorization_header)
0
+    authorization_header = @authenticated_conn.__send__(:authorization_header)
0
     assert_equal @authorization_request_header['Authorization'], authorization_header['Authorization']
0
     authorization = authorization_header["Authorization"].to_s.split
0
     
0
@@ -29,7 +29,7 @@ class AuthorizationTest < Test::Unit::TestCase
0
   
0
   def test_authorization_header_with_username_but_no_password
0
     @conn = ActiveResource::Connection.new("http://david:@localhost")
0
-    authorization_header = @conn.send!(:authorization_header)
0
+    authorization_header = @conn.__send__(:authorization_header)
0
     authorization = authorization_header["Authorization"].to_s.split
0
     
0
     assert_equal "Basic", authorization[0]
0
@@ -38,7 +38,7 @@ class AuthorizationTest < Test::Unit::TestCase
0
   
0
   def test_authorization_header_with_password_but_no_username
0
     @conn = ActiveResource::Connection.new("http://:test123@localhost")
0
-    authorization_header = @conn.send!(:authorization_header)
0
+    authorization_header = @conn.__send__(:authorization_header)
0
     authorization = authorization_header["Authorization"].to_s.split
0
     
0
     assert_equal "Basic", authorization[0]
0
@@ -47,7 +47,7 @@ class AuthorizationTest < Test::Unit::TestCase
0
   
0
   def test_authorization_header_with_decoded_credentials_from_url
0
     @conn = ActiveResource::Connection.new("http://my%40email.com:%31%32%33@localhost")
0
-    authorization_header = @conn.send!(:authorization_header)
0
+    authorization_header = @conn.__send__(:authorization_header)
0
     authorization = authorization_header["Authorization"].to_s.split
0
 
0
     assert_equal "Basic", authorization[0]
0
@@ -58,7 +58,7 @@ class AuthorizationTest < Test::Unit::TestCase
0
     @authenticated_conn = ActiveResource::Connection.new("http://@localhost")
0
     @authenticated_conn.user = 'david'
0
     @authenticated_conn.password = 'test123'
0
-    authorization_header = @authenticated_conn.send!(:authorization_header)
0
+    authorization_header = @authenticated_conn.__send__(:authorization_header)
0
     assert_equal @authorization_request_header['Authorization'], authorization_header['Authorization']
0
     authorization = authorization_header["Authorization"].to_s.split
0
 
0
@@ -69,7 +69,7 @@ class AuthorizationTest < Test::Unit::TestCase
0
   def test_authorization_header_explicitly_setting_username_but_no_password
0
     @conn = ActiveResource::Connection.new("http://@localhost")
0
     @conn.user = "david"
0
-    authorization_header = @conn.send!(:authorization_header)
0
+    authorization_header = @conn.__send__(:authorization_header)
0
     authorization = authorization_header["Authorization"].to_s.split
0
 
0
     assert_equal "Basic", authorization[0]
0
@@ -79,7 +79,7 @@ class AuthorizationTest < Test::Unit::TestCase
0
   def test_authorization_header_explicitly_setting_password_but_no_username
0
     @conn = ActiveResource::Connection.new("http://@localhost")
0
     @conn.password = "test123"
0
-    authorization_header = @conn.send!(:authorization_header)
0
+    authorization_header = @conn.__send__(:authorization_header)
0
     authorization = authorization_header["Authorization"].to_s.split
0
 
0
     assert_equal "Basic", authorization[0]
0
@@ -116,7 +116,7 @@ class AuthorizationTest < Test::Unit::TestCase
0
   protected
0
     def assert_response_raises(klass, code)
0
       assert_raise(klass, "Expected response code #{code} to raise #{klass}") do
0
-        @conn.send!(:handle_response, Response.new(code))
0
+        @conn.__send__(:handle_response, Response.new(code))
0
       end
0
     end
0
 end
...
84
85
86
87
 
88
89
90
...
100
101
102
103
 
104
105
106
...
84
85
86
 
87
88
89
90
...
100
101
102
 
103
104
105
106
0
@@ -84,7 +84,7 @@ class BaseLoadTest < Test::Unit::TestCase
0
   end
0
 
0
   def test_load_collection_with_unknown_resource
0
-    Person.send!(:remove_const, :Address) if Person.const_defined?(:Address)
0
+    Person.__send__(:remove_const, :Address) if Person.const_defined?(:Address)
0
     assert !Person.const_defined?(:Address), "Address shouldn't exist until autocreated"
0
     addresses = silence_warnings { @person.load(:addresses => @addresses).addresses }
0
     assert Person.const_defined?(:Address), "Address should have been autocreated"
0
@@ -100,7 +100,7 @@ class BaseLoadTest < Test::Unit::TestCase
0
   end
0
 
0
   def test_load_collection_with_single_unknown_resource
0
-    Person.send!(:remove_const, :Address) if Person.const_defined?(:Address)
0
+    Person.__send__(:remove_const, :Address) if Person.const_defined?(:Address)
0
     assert !Person.const_defined?(:Address), "Address shouldn't exist until autocreated"
0
     addresses = silence_warnings { @person.load(:addresses => [ @first_address ]).addresses }
0
     assert Person.const_defined?(:Address), "Address should have been autocreated"
...
468
469
470
471
 
472
473
474
...
504
505
506
507
 
508
509
510
...
607
608
609
610
 
611
612
613
 
614
615
616
...
468
469
470
 
471
472
473
474
...
504
505
506
 
507
508
509
510
...
607
608
609
 
610
611
612
 
613
614
615
616
0
@@ -468,7 +468,7 @@ class BaseTest < Test::Unit::TestCase
0
 
0
   def test_prefix
0
     assert_equal "/", Person.prefix
0
-    assert_equal Set.new, Person.send!(:prefix_parameters)
0
+    assert_equal Set.new, Person.__send__(:prefix_parameters)
0
   end
0
 
0
   def test_set_prefix
0
@@ -504,7 +504,7 @@ class BaseTest < Test::Unit::TestCase
0
   def test_custom_prefix
0
     assert_equal '/people//', StreetAddress.prefix
0
     assert_equal '/people/1/', StreetAddress.prefix(:person_id => 1)
0
-    assert_equal [:person_id].to_set, StreetAddress.send!(:prefix_parameters)
0
+    assert_equal [:person_id].to_set, StreetAddress.__send__(:prefix_parameters)
0
   end
0
 
0
   def test_find_by_id
0
@@ -607,10 +607,10 @@ class BaseTest < Test::Unit::TestCase
0
   def test_id_from_response
0
     p = Person.new
0
     resp = {'Location' => '/foo/bar/1'}
0
-    assert_equal '1', p.send!(:id_from_response, resp)
0
+    assert_equal '1', p.__send__(:id_from_response, resp)
0
 
0
     resp['Location'] << '.xml'
0
-    assert_equal '1', p.send!(:id_from_response, resp)
0
+    assert_equal '1', p.__send__(:id_from_response, resp)
0
   end
0
 
0
   def test_create_with_custom_prefix
...
185
186
187
188
 
189
190
...
185
186
187
 
188
189
190
0
@@ -185,6 +185,6 @@ class ConnectionTest < Test::Unit::TestCase
0
     end
0
 
0
     def handle_response(response)
0
-      @conn.send!(:handle_response, response)
0
+      @conn.__send__(:handle_response, response)
0
     end
0
 end
...
1
2
3
4
5
6
7
8
9
...
1
 
 
 
 
 
2
3
4
0
@@ -1,9 +1,4 @@
0
 class Object
0
-  unless respond_to?(:send!)
0
-    # Anticipating Ruby 1.9 neutering send
0
-    alias send! send
0
-  end
0
-
0
   # A Ruby-ized realization of the K combinator, courtesy of Mikael Brockman.
0
   #
0
   #   def foo
...
78
79
80
81
 
82
83
84
...
78
79
80
 
81
82
83
84
0
@@ -78,7 +78,7 @@ module ActiveSupport #:nodoc:
0
         #
0
         #   Time.utc(2000).in_time_zone('Alaska')  # => Fri, 31 Dec 1999 15:00:00 AKST -09:00
0
         def in_time_zone(zone = ::Time.zone)
0
-          ActiveSupport::TimeWithZone.new(utc? ? self : getutc, ::Time.send!(:get_zone, zone))
0
+          ActiveSupport::TimeWithZone.new(utc? ? self : getutc, ::Time.__send__(:get_zone, zone))
0
         end
0
       end
0
     end
...
11
12
13
14
 
15
16
17
...
11
12
13
 
14
15
16
17
0
@@ -11,7 +11,7 @@ module ActiveSupport
0
     private
0
       def method_missing(method, *arguments, &block)
0
         arguments << (arguments.last.respond_to?(:to_hash) ? @options.deep_merge(arguments.pop) : @options.dup)
0
-        @context.send!(method, *arguments, &block)
0
+        @context.__send__(method, *arguments, &block)
0
       end
0
   end
0
 end
...
36
37
38
39
 
 
 
 
 
40
41
42
...
36
37
38
 
39
40
41
42
43
44
45
46
0
@@ -36,7 +36,11 @@ module Test
0
       #     post :delete, :id => ...
0
       #   end
0
       def assert_difference(expressions, difference = 1, message = nil, &block)
0
-        expression_evaluations = Array(expressions).collect{ |expression| lambda { eval(expression, block.send!(:binding)) } }
0
+        expression_evaluations = Array(expressions).map do |expression|
0
+          lambda do
0
+            eval(expression, block.__send__(:binding))
0
+          end
0
+        end
0
 
0
         original_values = expression_evaluations.inject([]) { |memo, expression| memo << expression.call }
0
         yield
...
275
276
277
278
 
279
280
281
...
275
276
277
 
278
279
280
281
0
@@ -275,7 +275,7 @@ module ActiveSupport
0
     end
0
     
0
     def marshal_load(variables)
0
-      initialize(variables[0].utc, ::Time.send!(:get_zone, variables[1]), variables[2].utc)
0
+      initialize(variables[0].utc, ::Time.__send__(:get_zone, variables[1]), variables[2].utc)
0
     end
0
 
0
     # Ensure proxy class responds to all methods that underlying time instance responds to.
...
62
63
64
65
 
66
67
68
...
75
76
77
78
 
79
80
 
81
82
83
...
733
734
735
736
 
737
738
739
...
62
63
64
 
65
66
67
68
...
75
76
77
 
78
79
 
80
81
82
83
...
733
734
735
 
736
737
738
739
0
@@ -62,7 +62,7 @@ class HashExtTest < Test::Unit::TestCase
0
     @symbols = @symbols.with_indifferent_access
0
     @mixed   = @mixed.with_indifferent_access
0
 
0
-    assert_equal 'a', @strings.send!(:convert_key, :a)
0
+    assert_equal 'a', @strings.__send__(:convert_key, :a)
0
 
0
     assert_equal 1, @strings.fetch('a')
0
     assert_equal 1, @strings.fetch(:a.to_s)
0
@@ -75,9 +75,9 @@ class HashExtTest < Test::Unit::TestCase
0
 
0
     hashes.each do |name, hash|
0
       method_map.sort_by { |m| m.to_s }.each do |meth, expected|
0
-        assert_equal(expected, hash.send!(meth, 'a'),
0
+        assert_equal(expected, hash.__send__(meth, 'a'),
0
                      "Calling #{name}.#{meth} 'a'")
0
-        assert_equal(expected, hash.send!(meth, :a),
0
+        assert_equal(expected, hash.__send__(meth, :a),
0
                      "Calling #{name}.#{meth} :a")
0
       end
0
     end
0
@@ -733,7 +733,7 @@ class HashToXmlTest < Test::Unit::TestCase
0
   
0
   def test_empty_string_works_for_typecast_xml_value    
0
     assert_nothing_raised do
0
-      Hash.send!(:typecast_xml_value, "")
0
+      Hash.__send__(:typecast_xml_value, "")
0
     end
0
   end
0
   
...
108
109
110
111
112
113
114
115
116
117
118
...
108
109
110
 
 
 
 
 
111
112
113
0
@@ -108,11 +108,6 @@ class ClassExtTest < Test::Unit::TestCase
0
 end
0
 
0
 class ObjectTests < Test::Unit::TestCase
0
-  def test_send_bang_aliases_send_before_19
0
-    assert_respond_to 'a', :send!
0
-    assert_equal 1, 'a'.send!(:size)
0
-  end
0
-
0
   def test_suppress_re_raises
0
     assert_raises(LoadError) { suppress(ArgumentError) {raise LoadError} }
0
   end
...
146
147
148
149
 
150
151
152
153
154
155
156
 
157
158
159
160
161
162
163
 
164
165
166
167
168
169
170
 
171
172
173
174
175
176
177
 
178
179
180
181
182
183
184
 
185
186
187
...
190
191
192
193
 
194
195
196
...
199
200
201
202
 
203
204
205
...
208
209
210
211
 
212
213
214
...
146
147
148
 
149
150
151
152
153
154
155
 
156
157
158
159
160
161
162
 
163
164
165
166
167
168
169
 
170
171
172
173
174
175
176
 
177
178
179
180
181
182
183
 
184
185
186
187
...
190
191
192
 
193
194
195
196
...
199
200
201
 
202
203
204
205
...
208
209
210
 
211
212
213
214
0
@@ -146,42 +146,42 @@ class DependenciesTest < Test::Unit::TestCase
0
   def test_directories_manifest_as_modules_unless_const_defined
0
     with_loading 'autoloading_fixtures' do
0
       assert_kind_of Module, ModuleFolder
0
-      Object.send! :remove_const, :ModuleFolder
0
+      Object.__send__ :remove_const, :ModuleFolder
0
     end
0
   end
0
 
0
   def test_module_with_nested_class
0
     with_loading 'autoloading_fixtures' do
0
       assert_kind_of Class, ModuleFolder::NestedClass
0
-      Object.send! :remove_const, :ModuleFolder
0
+      Object.__send__ :remove_const, :ModuleFolder
0
     end
0
   end
0
 
0
   def test_module_with_nested_inline_class
0
     with_loading 'autoloading_fixtures' do
0
       assert_kind_of Class, ModuleFolder::InlineClass
0
-      Object.send! :remove_const, :ModuleFolder
0
+      Object.__send__ :remove_const, :ModuleFolder
0
     end
0
   end
0
 
0
   def test_directories_may_manifest_as_nested_classes
0
     with_loading 'autoloading_fixtures' do
0
       assert_kind_of Class, ClassFolder
0
-      Object.send! :remove_const, :ClassFolder
0
+      Object.__send__ :remove_const, :ClassFolder
0
     end
0
   end
0
 
0
   def test_class_with_nested_class
0
     with_loading 'autoloading_fixtures' do
0
       assert_kind_of Class, ClassFolder::NestedClass
0
-      Object.send! :remove_const, :ClassFolder
0
+      Object.__send__ :remove_const, :ClassFolder
0
     end
0
   end
0
 
0
   def test_class_with_nested_inline_class
0
     with_loading 'autoloading_fixtures' do
0
       assert_kind_of Class, ClassFolder::InlineClass
0
-      Object.send! :remove_const, :ClassFolder
0
+      Object.__send__ :remove_const, :ClassFolder
0
     end
0
   end
0
 
0
@@ -190,7 +190,7 @@ class DependenciesTest < Test::Unit::TestCase
0
       assert_kind_of Class, ClassFolder::ClassFolderSubclass
0
       assert_kind_of Class, ClassFolder
0
       assert_equal 'indeed', ClassFolder::ClassFolderSubclass::ConstantInClassFolder
0
-      Object.send! :remove_const, :ClassFolder
0
+      Object.__send__ :remove_const, :ClassFolder
0
     end
0
   end
0
 
0
@@ -199,7 +199,7 @@ class DependenciesTest < Test::Unit::TestCase
0
       sibling = ModuleFolder::NestedClass.class_eval "NestedSibling"
0
       assert defined?(ModuleFolder::NestedSibling)
0
       assert_equal ModuleFolder::NestedSibling, sibling
0
-      Object.send! :remove_const, :ModuleFolder
0
+      Object.__send__ :remove_const, :ModuleFolder
0
     end
0
   end
0
 
0
@@ -208,7 +208,7 @@ class DependenciesTest < Test::Unit::TestCase
0
       assert ! defined?(ModuleFolder)
0
       assert_raises(NameError) { ModuleFolder::Object }
0
       assert_raises(NameError) { ModuleFolder::NestedClass::Object }
0
-      Object.send! :remove_const, :ModuleFolder
0
+      Object.__send__ :remove_const, :ModuleFolder
0
     end
0
   end
0
 
...
488
489
490
491
 
492
493
494
...
488
489
490
 
491
492
493
494
0
@@ -488,7 +488,7 @@ Run `rake gems:install` to install the missing gems.
0
     # If assigned value cannot be matched to a TimeZone, an exception will be raised.
0
     def initialize_time_zone
0
       if configuration.time_zone
0
-        zone_default = Time.send!(:get_zone, configuration.time_zone)
0
+        zone_default = Time.__send__(:get_zone, configuration.time_zone)
0
         unless zone_default
0
           raise %{Value assigned to config.time_zone not recognized. Run "rake -D time" for a list of tasks for finding appropriate time zone names.}
0
         end

Comments

smtlaissezfaire Mon Sep 01 00:37:45 -0700 2008

Why aren’t these instances converted to instance_eval { … } ? 1.9 Is still only allowing public calls through send, correct?