GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

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