Module: ActionView::Helpers::CaptureHelper

Defined in:
lib/gems/haml-2.0.4/lib/haml/helpers/action_view_mods.rb,
lib/gems/haml-2.0.4/lib/haml/helpers/action_view_mods.rb

Instance Method Summary collapse

Instance Method Details

#capture_erb_with_buffer_with_haml(buffer, *args, &block) ⇒ Object Also known as: capture_erb_with_buffer



71
72
73
74
75
76
77
# File 'lib/gems/haml-2.0.4/lib/haml/helpers/action_view_mods.rb', line 71

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) ⇒ Object Also known as: capture



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/gems/haml-2.0.4/lib/haml/helpers/action_view_mods.rb', line 49

def capture_with_haml(*args, &block)
  # Rails' #capture helper will just return the value of the block
  # if it's not actually in the template context,
  # as detected by the existance of an _erbout variable.
  # We've got to do the same thing for compatibility.
  block_is_haml =
    begin
      eval('_hamlout', block)
      true
    rescue
      false
    end

  if block_is_haml && is_haml?
    capture_haml(*args, &block)
  else
    capture_without_haml(*args, &block)
  end
end