Module: Haml::More::ContentFor

Includes:
AbstractHelper
Defined in:
lib/haml/more/content_for.rb

Instance Method Summary collapse

Methods included from AbstractHelper

#haml_helper, included

Instance Method Details

#content_for(name, &block) ⇒ Object



6
7
8
9
10
11
# File 'lib/haml/more/content_for.rb', line 6

def content_for(name, &block)
  name = name.to_s
  @content_for ||= Hash.new {|h,k| h[k] = [] }
  @content_for[name] << block if block
  @content_for[name]
end

#get_content(name, *args) ⇒ Object



22
23
24
# File 'lib/haml/more/content_for.rb', line 22

def get_content(name, *args)
  non_haml { yield_content(name, *args) }
end

#yield_content(name, *args) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/haml/more/content_for.rb', line 13

def yield_content(name, *args)
  haml_helper do
    content_for(name).each do |block|
      result = block.call(*args)
      haml_concat result unless block_is_haml? block
    end
  end
end