From b8614eae6fb2f3df9fd74acc24b9bc8c9a441d06 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Sat, 15 Mar 2008 14:14:12 -0700 Subject: [PATCH] Override ActionView's #capture helper, so that it can be safely used within a helper. --- lib/haml/helpers/action_view_mods.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/haml/helpers/action_view_mods.rb b/lib/haml/helpers/action_view_mods.rb index fa0b9fc7..808c0fa0 100644 --- a/lib/haml/helpers/action_view_mods.rb +++ b/lib/haml/helpers/action_view_mods.rb @@ -17,6 +17,16 @@ if defined?(ActionView) and not defined?(Merb::Plugins) module Helpers # :stopdoc: module CaptureHelper + def capture_with_haml(*args, &block) + if is_haml? + capture_haml(*args, &block) + else + capture_without_haml(*args, &block) + end + end + alias_method :capture_without_haml, :capture + alias_method :capture, :capture_with_haml + def capture_erb_with_buffer_with_haml(*args, &block) if is_haml? capture_haml_with_buffer(*args, &block)