Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

YAGNI Method references. Deprecated

  • Loading branch information...
commit d6e4113c83a9d55be6f2af247da2cecaa855f43b 1 parent 6b4da2e
Yehuda Katz authored
View
10 actionpack/test/controller/filters_test.rb
@@ -876,10 +876,12 @@ def test_with_instance
assert_raise(After) { test_process(controller,'raises_after') }
end
- def test_with_method
- controller = ControllerWithFilterMethod
- assert_nothing_raised { test_process(controller,'no_raise') }
- assert_raise(After) { test_process(controller,'raises_after') }
+ for_tag(:old_base) do
+ def test_with_method
+ controller = ControllerWithFilterMethod
+ assert_nothing_raised { test_process(controller,'no_raise') }
+ assert_raise(After) { test_process(controller,'raises_after') }
+ end
end
def test_with_proc
View
17 activesupport/lib/active_support/new_callbacks.rb
@@ -180,9 +180,10 @@ def start(key = nil, options = {})
filter = <<-RUBY_EVAL
unless halted
result = #{@filter}
- halted ||= (#{terminator})
+ halted = (#{terminator})
end
RUBY_EVAL
+
[@compiled_options[0], filter, @compiled_options[1]].compact.join("\n")
else
# Compile around filters with conditions into proxy methods
@@ -201,7 +202,7 @@ def start(key = nil, options = {})
# end
name = "_conditional_callback_#{@kind}_#{next_id}"
- txt = <<-RUBY_EVAL
+ txt, line = <<-RUBY_EVAL, __LINE__
def #{name}(halted)
#{@compiled_options[0] || "if true"} && !halted
#{@filter} do
@@ -212,7 +213,7 @@ def #{name}(halted)
end
end
RUBY_EVAL
- @klass.class_eval(txt)
+ @klass.class_eval(txt, __FILE__, line)
"#{name}(halted) do"
end
end
@@ -291,15 +292,7 @@ def _compile_filter(filter)
" self, Proc.new "
else
""
- end
- when Method
- @klass.send(:define_method, "#{method_name}_method") { filter }
- @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
- def #{method_name}(&blk)
- #{method_name}_method.call(self, &blk)
- end
- RUBY_EVAL
- method_name
+ end
when String
@klass.class_eval <<-RUBY_EVAL
def #{method_name}
Please sign in to comment.
Something went wrong with that request. Please try again.