Module: Primer::Helpers::ERB

Defined in:
lib/primer/helpers.rb

Instance Method Summary collapse

Instance Method Details

#primer(cache_key, tag_name = :div, &block) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/primer/helpers.rb', line 5

def primer(cache_key, tag_name = :div, &block)
  result = Primer.cache.compute(cache_key) do
    block_given? ?
        primer_capture_output(&block) :
        Primer.cache.routes.evaluate(cache_key)
  end
  
  if Primer.real_time and not block_given?
    result = primer_real_time(result, tag_name, cache_key)
  end
  
  return result unless block_given?
  primer_detect_buffer.concat(result)
  nil
end