Module: ActionView::Helpers::CaptureHelper
- Defined in:
- /build/buildd/ruby-haml-3.1.4/lib/haml/helpers/xss_mods.rb,
/build/buildd/ruby-haml-3.1.4/lib/haml/helpers/action_view_mods.rb,
/build/buildd/ruby-haml-3.1.4/lib/haml/helpers/action_view_mods.rb
Instance Method Summary (collapse)
- - capture_erb_with_buffer_with_haml(buffer, *args, &block) (also: #capture_erb_with_buffer)
- - capture_with_haml(*args, &block) (also: #capture)
- - with_output_buffer_with_haml_xss(*args, &block) (also: #with_output_buffer)
Instance Method Details
- capture_erb_with_buffer_with_haml(buffer, *args, &block) Also known as: capture_erb_with_buffer
65 66 67 68 69 70 71 |
# File '/build/buildd/ruby-haml-3.1.4/lib/haml/helpers/action_view_mods.rb', line 65
def capture_erb_with_buffer_with_haml(buffer, *args, &block)
if is_haml?
capture_haml(*args, &block)
else
capture_erb_with_buffer_without_haml(buffer, *args, &block)
end
end
|
- capture_with_haml(*args, &block) Also known as: capture
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File '/build/buildd/ruby-haml-3.1.4/lib/haml/helpers/action_view_mods.rb', line 47
def capture_with_haml(*args, &block)
if Haml::Helpers.block_is_haml?(block)
_hamlout = eval('_hamlout', block.binding) # Necessary since capture_haml checks _hamlout
value = nil
buffer = capture_haml(*args) { value = yield(*args) }
str =
if !buffer.empty?
buffer
elsif value.is_a?(String)
value
else
''
end
return ActionView::NonConcattingString.new(str) if defined?(ActionView::NonConcattingString)
return str
else
capture_without_haml(*args, &block)
end
end
|
- with_output_buffer_with_haml_xss(*args, &block) Also known as: with_output_buffer
108 109 110 111 112 113 114 115 |
# File '/build/buildd/ruby-haml-3.1.4/lib/haml/helpers/xss_mods.rb', line 108
def with_output_buffer_with_haml_xss(*args, &block)
res = with_output_buffer_without_haml_xss(*args, &block)
case res
when Array; res.map {|s| Haml::Util.html_safe(s)}
when String; Haml::Util.html_safe(res)
else; res
end
end
|