aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-06-06 18:01:14 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-06-06 18:01:14 -0700
commitfe9d2ad6e84626d34f1850ef4668a87787d5c6b0 (patch)
treecdf7ec66399be11bc0ba25cb223995def4b8181c /actionpack
parent26ec1be24a820327d00e22fb65764a3dc06977e2 (diff)
downloadrails-fe9d2ad6e84626d34f1850ef4668a87787d5c6b0.tar.gz
rails-fe9d2ad6e84626d34f1850ef4668a87787d5c6b0.tar.bz2
rails-fe9d2ad6e84626d34f1850ef4668a87787d5c6b0.zip
Remove some internal dead code that supported content_for
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/helpers/capture_helper.rb20
-rw-r--r--actionpack/test/controller/capture_test.rb20
-rw-r--r--actionpack/test/fixtures/test/block_content_for.erb2
-rw-r--r--actionpack/test/fixtures/test/erb_content_for.erb2
4 files changed, 6 insertions, 38 deletions
diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb
index 837305d96c..25e62f78fb 100644
--- a/actionpack/lib/action_view/helpers/capture_helper.rb
+++ b/actionpack/lib/action_view/helpers/capture_helper.rb
@@ -32,7 +32,7 @@ module ActionView
#
def capture(*args, &block)
if @output_buffer
- with_temporary_output_buffer { yield *args }
+ with_output_buffer { block.call(*args) }
else
block.call(*args)
end
@@ -115,27 +115,17 @@ module ActionView
# <tt><%= yield :footer %></tt>.
def content_for(name, content = nil, &block)
ivar = "@content_for_#{name}"
- instance_variable_set("@content_for_#{name}", "#{instance_variable_get(ivar)}#{block_given? ? capture(&block) : content}")
+ content = capture(&block) if block_given?
+ instance_variable_set(ivar, "#{instance_variable_get(ivar)}#{content}")
end
private
- def with_temporary_output_buffer
- @output_buffer, old_buffer = '', @output_buffer
+ def with_output_buffer(buf = '')
+ @output_buffer, old_buffer = buf, @output_buffer
yield
- @output_buffer
ensure
@output_buffer = old_buffer
end
-
- def erb_content_for(name, &block)
- ivar = "@content_for_#{name}"
- instance_variable_set(ivar, "#{instance_variable_get(ivar)}#{capture(&block)}")
- end
-
- def block_content_for(name)
- ivar = "@content_for_#{name}"
- instance_variable_set(ivar, "#{instance_variable_get(ivar)}#{yield}")
- end
end
end
end
diff --git a/actionpack/test/controller/capture_test.rb b/actionpack/test/controller/capture_test.rb
index aaafea3920..2604844b84 100644
--- a/actionpack/test/controller/capture_test.rb
+++ b/actionpack/test/controller/capture_test.rb
@@ -11,16 +11,8 @@ class CaptureController < ActionController::Base
def content_for_with_parameter
render :layout => "talk_from_action"
end
-
- def content_for_concatenated
- render :layout => "talk_from_action"
- end
- def erb_content_for
- render :layout => "talk_from_action"
- end
-
- def block_content_for
+ def content_for_concatenated
render :layout => "talk_from_action"
end
@@ -62,21 +54,11 @@ class CaptureTest < Test::Unit::TestCase
assert_equal expected_content_for_output, @response.body
end
- def test_erb_content_for
- get :erb_content_for
- assert_equal expected_content_for_output, @response.body
- end
-
def test_should_set_content_for_with_parameter
get :content_for_with_parameter
assert_equal expected_content_for_output, @response.body
end
- def test_block_content_for
- get :block_content_for
- assert_equal expected_content_for_output, @response.body
- end
-
def test_non_erb_block_content_for
get :non_erb_block_content_for
assert_equal expected_content_for_output, @response.body
diff --git a/actionpack/test/fixtures/test/block_content_for.erb b/actionpack/test/fixtures/test/block_content_for.erb
deleted file mode 100644
index 9510337365..0000000000
--- a/actionpack/test/fixtures/test/block_content_for.erb
+++ /dev/null
@@ -1,2 +0,0 @@
-<% block_content_for :title do 'Putting stuff in the title!' end %>
-Great stuff! \ No newline at end of file
diff --git a/actionpack/test/fixtures/test/erb_content_for.erb b/actionpack/test/fixtures/test/erb_content_for.erb
deleted file mode 100644
index c3bdd13643..0000000000
--- a/actionpack/test/fixtures/test/erb_content_for.erb
+++ /dev/null
@@ -1,2 +0,0 @@
-<% erb_content_for :title do %>Putting stuff in the title!<% end %>
-Great stuff! \ No newline at end of file