Module: Fragmentary::FragmentsHelper

Defined in:
lib/fragmentary/fragments_helper.rb

Defined Under Namespace

Classes: CacheBuilder

Instance Method Summary collapse

Instance Method Details

#cache_fragment(options, &block) ⇒ Object



5
6
7
8
# File 'lib/fragmentary/fragments_helper.rb', line 5

def cache_fragment(options, &block)
  options.reverse_merge!(Fragmentary.config.application_root_url_column => Fragmentary.application_root_url.gsub(%r{https?://}, ''))
  CacheBuilder.new(self).cache_fragment(options, &block)
end

#fragment_builder(options) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/fragmentary/fragments_helper.rb', line 10

def fragment_builder(options)
  # the template option is deprecated but avoids breaking prior usage
  template = options.delete(:template) || self
  options.reverse_merge!(:user => Template.new(template).current_user)
  options.reverse_merge!(Fragmentary.config.application_root_url_column => Fragmentary.application_root_url.gsub(%r{https?://}, ''))
  CacheBuilder.new(template, Fragmentary::Fragment.base_class.existing(options))
end