1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Eliminate warnings for AM on 1.8

This commit is contained in:
wycats 2010-03-16 23:24:00 -07:00
parent c738812415
commit cd9ffd11e1
11 changed files with 47 additions and 13 deletions

View file

@ -31,9 +31,6 @@ module ActionMailer
# replies to this message.
adv_attr_accessor :reply_to
# Specify additional headers to be added to the message.
adv_attr_accessor :headers
# Specify the order in which parts should be sorted, based on content-type.
# This defaults to the value for the +default_implicit_parts_order+.
adv_attr_accessor :implicit_parts_order

View file

@ -1,4 +1,23 @@
require File.expand_path('../../../load_paths', __FILE__)
# Pathname has a warning, so require it first while silencing
# warnings to shut it up.
#
# Also, in 1.9, Bundler creates warnings due to overriding
# Rubygems methods
begin
old, $VERBOSE = $VERBOSE, nil
require 'pathname'
require File.expand_path('../../../load_paths', __FILE__)
ensure
$VERBOSE = old
end
require 'active_support/core_ext/kernel/reporting'
silence_warnings do
# These external dependencies have warnings :/
require 'text/format'
require 'mail'
end
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)

View file

@ -31,6 +31,8 @@ class TestMailer < ActionMailer::Base
attr_accessor :received_body
end
remove_method :receive
def receive(mail)
self.class.received_body = mail.body
end

View file

@ -1,3 +1,5 @@
require "active_support/core_ext/module/remove_method"
module AbstractController
# Layouts reverse the common pattern of including shared headers and footers in many templates to isolate changes in
# repeated setups. The inclusion pattern has pages that look like this:
@ -237,6 +239,8 @@ module AbstractController
# name, return that string. Otherwise, use the superclass'
# layout (which might also be implied)
def _write_layout_method
remove_possible_method(:_layout)
case defined?(@_layout) ? @_layout : nil
when String
self.class_eval %{def _layout; #{@_layout.inspect} end}

View file

@ -34,7 +34,7 @@ module ActionController
# and response object available. You might wish to control the
# environment and response manually for performance reasons.
attr_internal :status, :headers, :content_type, :response, :request
attr_internal :headers, :response, :request
delegate :session, :to => "@_request"
def initialize(*)
@ -62,6 +62,10 @@ module ActionController
headers["Location"] = url
end
def status
@_status
end
def status=(status)
@_status = Rack::Utils.status_code(status)
end

View file

@ -5,10 +5,8 @@ module ActionController
module RackDelegation
extend ActiveSupport::Concern
included do
delegate :headers, :status=, :location=, :content_type=,
:status, :location, :content_type, :to => "@_response"
end
delegate :headers, :status=, :location=, :content_type=,
:status, :location, :content_type, :to => "@_response"
def dispatch(action, request)
@_response = ActionDispatch::Response.new

View file

@ -25,7 +25,6 @@ module ActionDispatch
module FilterParameters
extend ActiveSupport::Concern
mattr_reader :compiled_parameter_filter_for
@@compiled_parameter_filter_for = {}
# Return a hash of parameters with all sensitive data replaced.

View file

@ -32,7 +32,7 @@ module ActionView
#
def capture(*args)
value = nil
buffer = with_output_buffer { value = yield *args }
buffer = with_output_buffer { value = yield(*args) }
if string = buffer.presence || value and string.is_a?(String)
NonConcattingString.new(string)
end

View file

@ -7,4 +7,5 @@ require 'active_support/core_ext/module/attr_internal'
require 'active_support/core_ext/module/attr_accessor_with_default'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/module/synchronization'
require 'active_support/core_ext/module/deprecation'
require 'active_support/core_ext/module/deprecation'
require 'active_support/core_ext/module/remove_method'

View file

@ -34,7 +34,7 @@ class Module
# class Foo
# CONSTANT_ARRAY = [0,1,2,3]
# @@class_array = [4,5,6,7]
#
#
# def initialize
# @instance_array = [8,9,10,11]
# end
@ -120,6 +120,10 @@ class Module
end
module_eval(<<-EOS, file, line)
if instance_methods(false).map(&:to_s).include?("#{prefix}#{method}")
remove_method("#{prefix}#{method}")
end
def #{prefix}#{method}(*args, &block) # def customer_name(*args, &block)
#{to}.__send__(#{method.inspect}, *args, &block) # client.__send__(:name, *args, &block)
rescue NoMethodError # rescue NoMethodError

View file

@ -0,0 +1,6 @@
class Module
def remove_possible_method(method)
remove_method(method)
rescue NameError
end
end