Permalink
Browse files

Get rid of 'Object#send!'. It was originally added because it's in Ru…

…by 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
  • Loading branch information...
1 parent e9a8e00 commit a1eb4e11c2cccb91483fa15f1a1a0b2ae518d2cf @jeremy jeremy committed Aug 31, 2008
Showing with 86 additions and 92 deletions.
  1. +2 −2 actionmailer/lib/action_mailer/helpers.rb
  2. +1 −1 actionpack/lib/action_controller/caching/actions.rb
  3. +3 −3 actionpack/lib/action_controller/caching/sweeping.rb
  4. +3 −3 actionpack/lib/action_controller/cgi_process.rb
  5. +1 −1 actionpack/lib/action_controller/components.rb
  6. +4 −4 actionpack/lib/action_controller/filters.rb
  7. +2 −2 actionpack/lib/action_controller/helpers.rb
  8. +1 −1 actionpack/lib/action_controller/http_authentication.rb
  9. +4 −4 actionpack/lib/action_controller/integration.rb
  10. +4 −4 actionpack/lib/action_controller/layout.rb
  11. +3 −3 actionpack/lib/action_controller/polymorphic_routes.rb
  12. +3 −3 actionpack/lib/action_controller/routing/route_set.rb
  13. +3 −3 actionpack/lib/action_controller/test_process.rb
  14. +2 −2 actionpack/lib/action_controller/verification.rb
  15. +1 −1 actionpack/lib/action_view/test_case.rb
  16. +4 −4 actionpack/test/controller/base_test.rb
  17. +2 −2 actionpack/test/controller/filter_params_test.rb
  18. +1 −1 actionpack/test/controller/filters_test.rb
  19. +1 −1 actionpack/test/controller/integration_test.rb
  20. +1 −1 activemodel/lib/active_model/validations.rb
  21. +1 −1 activeresource/lib/active_resource/base.rb
  22. +2 −2 activeresource/lib/active_resource/custom_methods.rb
  23. +8 −8 activeresource/test/authorization_test.rb
  24. +2 −2 activeresource/test/base/load_test.rb
  25. +4 −4 activeresource/test/base_test.rb
  26. +1 −1 activeresource/test/connection_test.rb
  27. +0 −5 activesupport/lib/active_support/core_ext/object/misc.rb
  28. +1 −1 activesupport/lib/active_support/core_ext/time/zones.rb
  29. +1 −1 activesupport/lib/active_support/option_merger.rb
  30. +5 −1 activesupport/lib/active_support/testing/core_ext/test/unit/assertions.rb
  31. +1 −1 activesupport/lib/active_support/time_with_zone.rb
  32. +4 −4 activesupport/test/core_ext/hash_ext_test.rb
  33. +0 −5 activesupport/test/core_ext/object_and_class_ext_test.rb
  34. +9 −9 activesupport/test/dependencies_test.rb
  35. +1 −1 railties/lib/initializer.rb
View
4 actionmailer/lib/action_mailer/helpers.rb
@@ -72,7 +72,7 @@ def helper_method(*methods)
methods.flatten.each do |method|
master_helper_module.module_eval <<-end_eval
def #{method}(*args, &block)
- controller.send!(%(#{method}), *args, &block)
+ controller.__send__(%(#{method}), *args, &block)
end
end_eval
end
@@ -92,7 +92,7 @@ def inherited_with_helper(child)
inherited_without_helper(child)
begin
child.master_helper_module = Module.new
- child.master_helper_module.send! :include, master_helper_module
+ child.master_helper_module.__send__(:include, master_helper_module)
child.helper child.name.to_s.underscore
rescue MissingSourceFile => e
raise unless e.is_missing?("helpers/#{child.name.to_s.underscore}_helper")
View
2 actionpack/lib/action_controller/caching/actions.rb
@@ -90,7 +90,7 @@ def before(controller)
set_content_type!(controller, cache_path.extension)
options = { :text => cache }
options.merge!(:layout => true) if cache_layout?
- controller.send!(:render, options)
+ controller.__send__(:render, options)
false
else
controller.action_cache_path = cache_path
View
6 actionpack/lib/action_controller/caching/sweeping.rb
@@ -83,13 +83,13 @@ def callback(timing)
controller_callback_method_name = "#{timing}_#{controller.controller_name.underscore}"
action_callback_method_name = "#{controller_callback_method_name}_#{controller.action_name}"
- send!(controller_callback_method_name) if respond_to?(controller_callback_method_name, true)
- send!(action_callback_method_name) if respond_to?(action_callback_method_name, true)
+ __send__(controller_callback_method_name) if respond_to?(controller_callback_method_name, true)
+ __send__(action_callback_method_name) if respond_to?(action_callback_method_name, true)
end
def method_missing(method, *arguments)
return if @controller.nil?
- @controller.send!(method, *arguments)
+ @controller.__send__(method, *arguments)
end
end
end
View
6 actionpack/lib/action_controller/cgi_process.rb
@@ -48,7 +48,7 @@ class SessionFixationAttempt < StandardError #:nodoc:
def initialize(cgi, session_options = {})
@cgi = cgi
@session_options = session_options
- @env = @cgi.send!(:env_table)
+ @env = @cgi.__send__(:env_table)
super()
end
@@ -107,7 +107,7 @@ def reset_session
end
def method_missing(method_id, *arguments)
- @cgi.send!(method_id, *arguments) rescue super
+ @cgi.__send__(method_id, *arguments) rescue super
end
private
@@ -164,7 +164,7 @@ def out(output = $stdout)
begin
output.write(@cgi.header(@headers))
- if @cgi.send!(:env_table)['REQUEST_METHOD'] == 'HEAD'
+ if @cgi.__send__(:env_table)['REQUEST_METHOD'] == 'HEAD'
return
elsif @body.respond_to?(:call)
# Flush the output now in case the @body Proc uses
View
2 actionpack/lib/action_controller/components.rb
@@ -65,7 +65,7 @@ def process_with_components(request, response, parent_controller = nil) #:nodoc:
module HelperMethods
def render_component(options)
- @controller.send!(:render_component_as_string, options)
+ @controller.__send__(:render_component_as_string, options)
end
end
View
8 actionpack/lib/action_controller/filters.rb
@@ -199,8 +199,8 @@ def around_proc
Proc.new do |controller, action|
method.before(controller)
- if controller.send!(:performed?)
- controller.send!(:halt_filter_chain, method, :rendered_or_redirected)
+ if controller.__send__(:performed?)
+ controller.__send__(:halt_filter_chain, method, :rendered_or_redirected)
else
begin
action.call
@@ -223,8 +223,8 @@ def before?
def call(controller, &block)
super
- if controller.send!(:performed?)
- controller.send!(:halt_filter_chain, method, :rendered_or_redirected)
+ if controller.__send__(:performed?)
+ controller.__send__(:halt_filter_chain, method, :rendered_or_redirected)
end
end
end
View
4 actionpack/lib/action_controller/helpers.rb
@@ -204,8 +204,8 @@ def inherited_with_helper(child)
begin
child.master_helper_module = Module.new
- child.master_helper_module.send! :include, master_helper_module
- child.send! :default_helper_module!
+ child.master_helper_module.__send__ :include, master_helper_module
+ child.__send__ :default_helper_module!
rescue MissingSourceFile => e
raise unless e.is_missing?("helpers/#{child.controller_path}_helper")
end
View
2 actionpack/lib/action_controller/http_authentication.rb
@@ -117,7 +117,7 @@ def encode_credentials(user_name, password)
def authentication_request(controller, realm)
controller.headers["WWW-Authenticate"] = %(Basic realm="#{realm.gsub(/"/, "")}")
- controller.send! :render, :text => "HTTP Basic: Access denied.\n", :status => :unauthorized
+ controller.__send__ :render, :text => "HTTP Basic: Access denied.\n", :status => :unauthorized
end
end
end
View
8 actionpack/lib/action_controller/integration.rb
@@ -444,7 +444,7 @@ def reset!
reset! unless @integration_session
# reset the html_document variable, but only for new get/post calls
@html_document = nil unless %w(cookies assigns).include?(method)
- returning @integration_session.send!(method, *args) do
+ returning @integration_session.__send__(method, *args) do
copy_session_variables!
end
end
@@ -469,12 +469,12 @@ def open_session
self.class.fixture_table_names.each do |table_name|
name = table_name.tr(".", "_")
next unless respond_to?(name)
- extras.send!(:define_method, name) { |*args| delegate.send(name, *args) }
+ extras.__send__(:define_method, name) { |*args| delegate.send(name, *args) }
end
end
# delegate add_assertion to the test case
- extras.send!(:define_method, :add_assertion) { test_result.add_assertion }
+ extras.__send__(:define_method, :add_assertion) { test_result.add_assertion }
session.extend(extras)
session.delegate = self
session.test_result = @_result
@@ -488,7 +488,7 @@ def open_session
def copy_session_variables! #:nodoc:
return unless @integration_session
%w(controller response request).each do |var|
- instance_variable_set("@#{var}", @integration_session.send!(var))
+ instance_variable_set("@#{var}", @integration_session.__send__(var))
end
end
View
8 actionpack/lib/action_controller/layout.rb
@@ -219,7 +219,7 @@ def active_layout(passed_layout = nil)
layout = passed_layout || self.class.default_layout(default_template_format)
active_layout = case layout
when String then layout
- when Symbol then send!(layout)
+ when Symbol then __send__(layout)
when Proc then layout.call(self)
end
@@ -238,7 +238,7 @@ def active_layout(passed_layout = nil)
private
def candidate_for_layout?(options)
options.values_at(:text, :xml, :json, :file, :inline, :partial, :nothing, :update).compact.empty? &&
- !@template.send(:_exempt_from_layout?, options[:template] || default_template_name(options[:action]))
+ !@template.__send__(:_exempt_from_layout?, options[:template] || default_template_name(options[:action]))
end
def pick_layout(options)
@@ -247,7 +247,7 @@ def pick_layout(options)
when FalseClass
nil
when NilClass, TrueClass
- active_layout if action_has_layout? && !@template.send(:_exempt_from_layout?, default_template_name)
+ active_layout if action_has_layout? && !@template.__send__(:_exempt_from_layout?, default_template_name)
else
active_layout(layout)
end
@@ -272,7 +272,7 @@ def action_has_layout?
end
def layout_directory?(layout_name)
- @template.send(:_pick_template, "#{File.join('layouts', layout_name)}.#{@template.template_format}") ? true : false
+ @template.__send__(:_pick_template, "#{File.join('layouts', layout_name)}.#{@template.template_format}") ? true : false
rescue ActionView::MissingTemplate
false
end
View
6 actionpack/lib/action_controller/polymorphic_routes.rb
@@ -108,7 +108,7 @@ def polymorphic_url(record_or_hash_or_array, options = {})
args.last.kind_of?(Hash) ? args.last.merge!(url_options) : args << url_options
end
- send!(named_route, *args)
+ __send__(named_route, *args)
end
# Returns the path component of a URL for the given record. It uses
@@ -149,15 +149,15 @@ def build_named_route_call(records, namespace, inflection, options = {})
if parent.is_a?(Symbol) || parent.is_a?(String)
string << "#{parent}_"
else
- string << "#{RecordIdentifier.send!("singular_class_name", parent)}_"
+ string << "#{RecordIdentifier.__send__("singular_class_name", parent)}_"
end
end
end
if record.is_a?(Symbol) || record.is_a?(String)
route << "#{record}_"
else
- route << "#{RecordIdentifier.send!("#{inflection}_class_name", record)}_"
+ route << "#{RecordIdentifier.__send__("#{inflection}_class_name", record)}_"
end
action_prefix(options) + namespace + route + routing_type(options).to_s
View
6 actionpack/lib/action_controller/routing/route_set.rb
@@ -115,7 +115,7 @@ def reset!
def install(destinations = [ActionController::Base, ActionView::Base], regenerate = false)
reset! if regenerate
Array(destinations).each do |dest|
- dest.send! :include, @module
+ dest.__send__(:include, @module)
end
end
@@ -353,15 +353,15 @@ def generate(options, recall = {}, method=:generate)
if generate_all
# Used by caching to expire all paths for a resource
return routes.collect do |route|
- route.send!(method, options, merged, expire_on)
+ route.__send__(method, options, merged, expire_on)
end.compact
end
# don't use the recalled keys when determining which routes to check
routes = routes_by_controller[controller][action][options.keys.sort_by { |x| x.object_id }]
routes.each do |route|
- results = route.send!(method, options, merged, expire_on)
+ results = route.__send__(method, options, merged, expire_on)
return results if results && (!results.is_a?(Array) || results.first)
end
end
View
6 actionpack/lib/action_controller/test_process.rb
@@ -357,7 +357,7 @@ def path #:nodoc:
alias local_path path
def method_missing(method_name, *args, &block) #:nodoc:
- @tempfile.send!(method_name, *args, &block)
+ @tempfile.__send__(method_name, *args, &block)
end
end
@@ -403,7 +403,7 @@ def process(action, parameters = nil, session = nil, flash = nil)
def xml_http_request(request_method, action, parameters = nil, session = nil, flash = nil)
@request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
@request.env['HTTP_ACCEPT'] = 'text/javascript, text/html, application/xml, text/xml, */*'
- returning send!(request_method, action, parameters, session, flash) do
+ returning __send__(request_method, action, parameters, session, flash) do
@request.env.delete 'HTTP_X_REQUESTED_WITH'
@request.env.delete 'HTTP_ACCEPT'
end
@@ -436,7 +436,7 @@ def redirect_to_url
def build_request_uri(action, parameters)
unless @request.env['REQUEST_URI']
- options = @controller.send!(:rewrite_options, parameters)
+ options = @controller.__send__(:rewrite_options, parameters)
options.update(:only_path => true, :action => action)
url = ActionController::UrlRewriter.new(@request, parameters)
View
4 actionpack/lib/action_controller/verification.rb
@@ -80,7 +80,7 @@ module ClassMethods
# array (may also be a single value).
def verify(options={})
before_filter :only => options[:only], :except => options[:except] do |c|
- c.send! :verify_action, options
+ c.__send__ :verify_action, options
end
end
end
@@ -116,7 +116,7 @@ def verify_request_xhr_status(options) # :nodoc:
end
def apply_redirect_to(redirect_to_option) # :nodoc:
- (redirect_to_option.is_a?(Symbol) && redirect_to_option != :back) ? self.send!(redirect_to_option) : redirect_to_option
+ (redirect_to_option.is_a?(Symbol) && redirect_to_option != :back) ? self.__send__(redirect_to_option) : redirect_to_option
end
def apply_remaining_actions(options) # :nodoc:
View
2 actionpack/lib/action_view/test_case.rb
@@ -54,7 +54,7 @@ def initialize
private
def method_missing(selector, *args)
controller = TestController.new
- return controller.send!(selector, *args) if ActionController::Routing::Routes.named_routes.helpers.include?(selector)
+ return controller.__send__(selector, *args) if ActionController::Routing::Routes.named_routes.helpers.include?(selector)
super
end
end
View
8 actionpack/test/controller/base_test.rb
@@ -84,11 +84,11 @@ def setup
def test_action_methods
@empty_controllers.each do |c|
hide_mocha_methods_from_controller(c)
- assert_equal Set.new, c.send!(:action_methods), "#{c.controller_path} should be empty!"
+ assert_equal Set.new, c.__send__(:action_methods), "#{c.controller_path} should be empty!"
end
@non_empty_controllers.each do |c|
hide_mocha_methods_from_controller(c)
- assert_equal Set.new(%w(public_action)), c.send!(:action_methods), "#{c.controller_path} should not be empty!"
+ assert_equal Set.new(%w(public_action)), c.__send__(:action_methods), "#{c.controller_path} should not be empty!"
end
end
@@ -100,7 +100,7 @@ def hide_mocha_methods_from_controller(controller)
:expects, :mocha, :mocha_inspect, :reset_mocha, :stubba_object,
:stubba_method, :stubs, :verify, :__metaclass__, :__is_a__, :to_matcher,
]
- controller.class.send!(:hide_action, *mocha_methods)
+ controller.class.__send__(:hide_action, *mocha_methods)
end
end
@@ -140,7 +140,7 @@ def test_get_on_priv_should_show_selector
def test_method_missing_is_not_an_action_name
use_controller MethodMissingController
- assert ! @controller.send!(:action_methods).include?('method_missing')
+ assert ! @controller.__send__(:action_methods).include?('method_missing')
get :method_missing
assert_response :success
View
4 actionpack/test/controller/filter_params_test.rb
@@ -27,7 +27,7 @@ def test_filter_parameters
test_hashes.each do |before_filter, after_filter, filter_words|
FilterParamController.filter_parameter_logging(*filter_words)
- assert_equal after_filter, @controller.send!(:filter_parameters, before_filter)
+ assert_equal after_filter, @controller.__send__(:filter_parameters, before_filter)
filter_words.push('blah')
FilterParamController.filter_parameter_logging(*filter_words) do |key, value|
@@ -37,7 +37,7 @@ def test_filter_parameters
before_filter['barg'] = {'bargain'=>'gain', 'blah'=>'bar', 'bar'=>{'bargain'=>{'blah'=>'foo'}}}
after_filter['barg'] = {'bargain'=>'niag', 'blah'=>'[FILTERED]', 'bar'=>{'bargain'=>{'blah'=>'[FILTERED]'}}}
- assert_equal after_filter, @controller.send!(:filter_parameters, before_filter)
+ assert_equal after_filter, @controller.__send__(:filter_parameters, before_filter)
end
end
View
2 actionpack/test/controller/filters_test.rb
@@ -364,7 +364,7 @@ def filter(controller)
begin
yield
rescue ErrorToRescue => ex
- controller.send! :render, :text => "I rescued this: #{ex.inspect}"
+ controller.__send__ :render, :text => "I rescued this: #{ex.inspect}"
end
end
end
View
2 actionpack/test/controller/integration_test.rb
@@ -243,7 +243,7 @@ def test_integration_methods_called
reset!
stub_integration_session(@integration_session)
%w( get post head put delete ).each do |verb|
- assert_nothing_raised("'#{verb}' should use integration test methods") { send!(verb, '/') }
+ assert_nothing_raised("'#{verb}' should use integration test methods") { __send__(verb, '/') }
end
end
end
View
2 activemodel/lib/active_model/validations.rb
@@ -4,7 +4,7 @@ module ActiveModel
module Validations
def self.included(base) # :nodoc:
base.extend(ClassMethods)
- base.send!(:include, ActiveSupport::Callbacks)
+ base.__send__(:include, ActiveSupport::Callbacks)
base.define_callbacks :validate, :validate_on_create, :validate_on_update
end
View
2 activeresource/lib/active_resource/base.rb
@@ -1012,7 +1012,7 @@ def find_or_create_resource_for(name)
end
def split_options(options = {})
- self.class.send!(:split_options, options)
+ self.class.__send__(:split_options, options)
end
def method_missing(method_symbol, *arguments) #:nodoc:
View
4 activeresource/lib/active_resource/custom_methods.rb
@@ -109,11 +109,11 @@ def delete(method_name, options = {})
private
def custom_method_element_url(method_name, options = {})
- "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{id}/#{method_name}.#{self.class.format.extension}#{self.class.send!(:query_string, options)}"
+ "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{id}/#{method_name}.#{self.class.format.extension}#{self.class.__send__(:query_string, options)}"
end
def custom_method_new_element_url(method_name, options = {})
- "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/new/#{method_name}.#{self.class.format.extension}#{self.class.send!(:query_string, options)}"
+ "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/new/#{method_name}.#{self.class.format.extension}#{self.class.__send__(:query_string, options)}"
end
end
end
View
16 activeresource/test/authorization_test.rb
@@ -19,7 +19,7 @@ def setup
end
def test_authorization_header
- authorization_header = @authenticated_conn.send!(:authorization_header)
+ authorization_header = @authenticated_conn.__send__(:authorization_header)
assert_equal @authorization_request_header['Authorization'], authorization_header['Authorization']
authorization = authorization_header["Authorization"].to_s.split
@@ -29,7 +29,7 @@ def test_authorization_header
def test_authorization_header_with_username_but_no_password
@conn = ActiveResource::Connection.new("http://david:@localhost")
- authorization_header = @conn.send!(:authorization_header)
+ authorization_header = @conn.__send__(:authorization_header)
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
@@ -38,7 +38,7 @@ def test_authorization_header_with_username_but_no_password
def test_authorization_header_with_password_but_no_username
@conn = ActiveResource::Connection.new("http://:test123@localhost")
- authorization_header = @conn.send!(:authorization_header)
+ authorization_header = @conn.__send__(:authorization_header)
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
@@ -47,7 +47,7 @@ def test_authorization_header_with_password_but_no_username
def test_authorization_header_with_decoded_credentials_from_url
@conn = ActiveResource::Connection.new("http://my%40email.com:%31%32%33@localhost")
- authorization_header = @conn.send!(:authorization_header)
+ authorization_header = @conn.__send__(:authorization_header)
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
@@ -58,7 +58,7 @@ def test_authorization_header_explicitly_setting_username_and_password
@authenticated_conn = ActiveResource::Connection.new("http://@localhost")
@authenticated_conn.user = 'david'
@authenticated_conn.password = 'test123'
- authorization_header = @authenticated_conn.send!(:authorization_header)
+ authorization_header = @authenticated_conn.__send__(:authorization_header)
assert_equal @authorization_request_header['Authorization'], authorization_header['Authorization']
authorization = authorization_header["Authorization"].to_s.split
@@ -69,7 +69,7 @@ def test_authorization_header_explicitly_setting_username_and_password
def test_authorization_header_explicitly_setting_username_but_no_password
@conn = ActiveResource::Connection.new("http://@localhost")
@conn.user = "david"
- authorization_header = @conn.send!(:authorization_header)
+ authorization_header = @conn.__send__(:authorization_header)
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
@@ -79,7 +79,7 @@ def test_authorization_header_explicitly_setting_username_but_no_password
def test_authorization_header_explicitly_setting_password_but_no_username
@conn = ActiveResource::Connection.new("http://@localhost")
@conn.password = "test123"
- authorization_header = @conn.send!(:authorization_header)
+ authorization_header = @conn.__send__(:authorization_header)
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
@@ -116,7 +116,7 @@ def test_raises_invalid_request_on_unauthorized_requests
protected
def assert_response_raises(klass, code)
assert_raise(klass, "Expected response code #{code} to raise #{klass}") do
- @conn.send!(:handle_response, Response.new(code))
+ @conn.__send__(:handle_response, Response.new(code))
end
end
end
View
4 activeresource/test/base/load_test.rb
@@ -84,7 +84,7 @@ def test_load_collection_with_existing_resource
end
def test_load_collection_with_unknown_resource
- Person.send!(:remove_const, :Address) if Person.const_defined?(:Address)
+ Person.__send__(:remove_const, :Address) if Person.const_defined?(:Address)
assert !Person.const_defined?(:Address), "Address shouldn't exist until autocreated"
addresses = silence_warnings { @person.load(:addresses => @addresses).addresses }
assert Person.const_defined?(:Address), "Address should have been autocreated"
@@ -100,7 +100,7 @@ def test_load_collection_with_single_existing_resource
end
def test_load_collection_with_single_unknown_resource
- Person.send!(:remove_const, :Address) if Person.const_defined?(:Address)
+ Person.__send__(:remove_const, :Address) if Person.const_defined?(:Address)
assert !Person.const_defined?(:Address), "Address shouldn't exist until autocreated"
addresses = silence_warnings { @person.load(:addresses => [ @first_address ]).addresses }
assert Person.const_defined?(:Address), "Address should have been autocreated"
View
8 activeresource/test/base_test.rb
@@ -468,7 +468,7 @@ def test_custom_collection_name
def test_prefix
assert_equal "/", Person.prefix
- assert_equal Set.new, Person.send!(:prefix_parameters)
+ assert_equal Set.new, Person.__send__(:prefix_parameters)
end
def test_set_prefix
@@ -504,7 +504,7 @@ def test_set_prefix_with_default_value
def test_custom_prefix
assert_equal '/people//', StreetAddress.prefix
assert_equal '/people/1/', StreetAddress.prefix(:person_id => 1)
- assert_equal [:person_id].to_set, StreetAddress.send!(:prefix_parameters)
+ assert_equal [:person_id].to_set, StreetAddress.__send__(:prefix_parameters)
end
def test_find_by_id
@@ -607,10 +607,10 @@ def test_save
def test_id_from_response
p = Person.new
resp = {'Location' => '/foo/bar/1'}
- assert_equal '1', p.send!(:id_from_response, resp)
+ assert_equal '1', p.__send__(:id_from_response, resp)
resp['Location'] << '.xml'
- assert_equal '1', p.send!(:id_from_response, resp)
+ assert_equal '1', p.__send__(:id_from_response, resp)
end
def test_create_with_custom_prefix
View
2 activeresource/test/connection_test.rb
@@ -185,6 +185,6 @@ def assert_response_raises(klass, code)
end
def handle_response(response)
- @conn.send!(:handle_response, response)
+ @conn.__send__(:handle_response, response)
end
end
View
5 activesupport/lib/active_support/core_ext/object/misc.rb
@@ -1,9 +1,4 @@
class Object
- unless respond_to?(:send!)
- # Anticipating Ruby 1.9 neutering send
- alias send! send
- end
-
# A Ruby-ized realization of the K combinator, courtesy of Mikael Brockman.
#
# def foo
View
2 activesupport/lib/active_support/core_ext/time/zones.rb
@@ -78,7 +78,7 @@ def get_zone(time_zone)
#
# Time.utc(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00
def in_time_zone(zone = ::Time.zone)
- ActiveSupport::TimeWithZone.new(utc? ? self : getutc, ::Time.send!(:get_zone, zone))
+ ActiveSupport::TimeWithZone.new(utc? ? self : getutc, ::Time.__send__(:get_zone, zone))
end
end
end
View
2 activesupport/lib/active_support/option_merger.rb
@@ -11,7 +11,7 @@ def initialize(context, options)
private
def method_missing(method, *arguments, &block)
arguments << (arguments.last.respond_to?(:to_hash) ? @options.deep_merge(arguments.pop) : @options.dup)
- @context.send!(method, *arguments, &block)
+ @context.__send__(method, *arguments, &block)
end
end
end
View
6 activesupport/lib/active_support/testing/core_ext/test/unit/assertions.rb
@@ -36,7 +36,11 @@ module Assertions
# post :delete, :id => ...
# end
def assert_difference(expressions, difference = 1, message = nil, &block)
- expression_evaluations = Array(expressions).collect{ |expression| lambda { eval(expression, block.send!(:binding)) } }
+ expression_evaluations = Array(expressions).map do |expression|
+ lambda do
+ eval(expression, block.__send__(:binding))
+ end
+ end
original_values = expression_evaluations.inject([]) { |memo, expression| memo << expression.call }
yield
View
2 activesupport/lib/active_support/time_with_zone.rb
@@ -275,7 +275,7 @@ def marshal_dump
end
def marshal_load(variables)
- initialize(variables[0].utc, ::Time.send!(:get_zone, variables[1]), variables[2].utc)
+ initialize(variables[0].utc, ::Time.__send__(:get_zone, variables[1]), variables[2].utc)
end
# Ensure proxy class responds to all methods that underlying time instance responds to.
View
8 activesupport/test/core_ext/hash_ext_test.rb
@@ -62,7 +62,7 @@ def test_indifferent_assorted
@symbols = @symbols.with_indifferent_access
@mixed = @mixed.with_indifferent_access
- assert_equal 'a', @strings.send!(:convert_key, :a)
+ assert_equal 'a', @strings.__send__(:convert_key, :a)
assert_equal 1, @strings.fetch('a')
assert_equal 1, @strings.fetch(:a.to_s)
@@ -75,9 +75,9 @@ def test_indifferent_assorted
hashes.each do |name, hash|
method_map.sort_by { |m| m.to_s }.each do |meth, expected|
- assert_equal(expected, hash.send!(meth, 'a'),
+ assert_equal(expected, hash.__send__(meth, 'a'),
"Calling #{name}.#{meth} 'a'")
- assert_equal(expected, hash.send!(meth, :a),
+ assert_equal(expected, hash.__send__(meth, :a),
"Calling #{name}.#{meth} :a")
end
end
@@ -733,7 +733,7 @@ def test_kernel_method_names_to_xml
def test_empty_string_works_for_typecast_xml_value
assert_nothing_raised do
- Hash.send!(:typecast_xml_value, "")
+ Hash.__send__(:typecast_xml_value, "")
end
end
View
5 activesupport/test/core_ext/object_and_class_ext_test.rb
@@ -108,11 +108,6 @@ def test_subclasses_of_doesnt_find_anonymous_classes
end
class ObjectTests < Test::Unit::TestCase
- def test_send_bang_aliases_send_before_19
- assert_respond_to 'a', :send!
- assert_equal 1, 'a'.send!(:size)
- end
-
def test_suppress_re_raises
assert_raises(LoadError) { suppress(ArgumentError) {raise LoadError} }
end
View
18 activesupport/test/dependencies_test.rb
@@ -146,42 +146,42 @@ def test_non_existing_const_raises_name_error
def test_directories_manifest_as_modules_unless_const_defined
with_loading 'autoloading_fixtures' do
assert_kind_of Module, ModuleFolder
- Object.send! :remove_const, :ModuleFolder
+ Object.__send__ :remove_const, :ModuleFolder
end
end
def test_module_with_nested_class
with_loading 'autoloading_fixtures' do
assert_kind_of Class, ModuleFolder::NestedClass
- Object.send! :remove_const, :ModuleFolder
+ Object.__send__ :remove_const, :ModuleFolder
end
end
def test_module_with_nested_inline_class
with_loading 'autoloading_fixtures' do
assert_kind_of Class, ModuleFolder::InlineClass
- Object.send! :remove_const, :ModuleFolder
+ Object.__send__ :remove_const, :ModuleFolder
end
end
def test_directories_may_manifest_as_nested_classes
with_loading 'autoloading_fixtures' do
assert_kind_of Class, ClassFolder
- Object.send! :remove_const, :ClassFolder
+ Object.__send__ :remove_const, :ClassFolder
end
end
def test_class_with_nested_class
with_loading 'autoloading_fixtures' do
assert_kind_of Class, ClassFolder::NestedClass
- Object.send! :remove_const, :ClassFolder
+ Object.__send__ :remove_const, :ClassFolder
end
end
def test_class_with_nested_inline_class
with_loading 'autoloading_fixtures' do
assert_kind_of Class, ClassFolder::InlineClass
- Object.send! :remove_const, :ClassFolder
+ Object.__send__ :remove_const, :ClassFolder
end
end
@@ -190,7 +190,7 @@ def test_class_with_nested_inline_subclass_of_parent
assert_kind_of Class, ClassFolder::ClassFolderSubclass
assert_kind_of Class, ClassFolder
assert_equal 'indeed', ClassFolder::ClassFolderSubclass::ConstantInClassFolder
- Object.send! :remove_const, :ClassFolder
+ Object.__send__ :remove_const, :ClassFolder
end
end
@@ -199,7 +199,7 @@ def test_nested_class_can_access_sibling
sibling = ModuleFolder::NestedClass.class_eval "NestedSibling"
assert defined?(ModuleFolder::NestedSibling)
assert_equal ModuleFolder::NestedSibling, sibling
- Object.send! :remove_const, :ModuleFolder
+ Object.__send__ :remove_const, :ModuleFolder
end
end
@@ -208,7 +208,7 @@ def failing_test_access_thru_and_upwards_fails
assert ! defined?(ModuleFolder)
assert_raises(NameError) { ModuleFolder::Object }
assert_raises(NameError) { ModuleFolder::NestedClass::Object }
- Object.send! :remove_const, :ModuleFolder
+ Object.__send__ :remove_const, :ModuleFolder
end
end
View
2 railties/lib/initializer.rb
@@ -488,7 +488,7 @@ def initialize_temporary_session_directory
# If assigned value cannot be matched to a TimeZone, an exception will be raised.
def initialize_time_zone
if configuration.time_zone
- zone_default = Time.send!(:get_zone, configuration.time_zone)
+ zone_default = Time.__send__(:get_zone, configuration.time_zone)
unless zone_default
raise %{Value assigned to config.time_zone not recognized. Run "rake -D time" for a list of tasks for finding appropriate time zone names.}
end

1 comment on commit a1eb4e1

@smtlaissezfaire

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

Please sign in to comment.