Sha256: 700b489c92de7811037d45cd37173f87d199fca303026d16441d36d11bd719d8

Contents?: true

Size: 1.02 KB

Versions: 50

Compression:

Stored size: 1.02 KB

Contents

module ExpireEditableFragment
  def expire_editable_fragment(record, fragments = [])
    fragments.uniq!
    if record.is_a?(Manifestation)
      if fragments.empty?
        fragments = %w[manifestation_html show_detail_user_html show_detail_librarian_html pickup_html title_html title_mobile index_sru]
      end
      expire_manifestation_cache(record, fragments)
    else
      I18n.available_locales.each do |locale|
        Role.all_cache.each do |role|
          fragments.each do |fragment|
            expire_fragment(":#{record.class.to_s.downcase}" => record.id, :fragment => fragment, :role => role.name, :locale => locale)
          end
        end
      end
    end
  end

  private
  def expire_manifestation_cache(manifestation, fragments = [])
    I18n.available_locales.each do |locale|
      Role.all_cache.each do |role|
        fragments.uniq.each do |fragment|
          expire_fragment([:manifestation => manifestation.id, :fragment => fragment, :role => role.name, :locale => locale])
        end
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 2 rubygems

Version Path
enju_circulation-0.0.51 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.50 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.49 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.48 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.47 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.46 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.45 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.43 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.42 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.41 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.40 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.39 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.38 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.37 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.36 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.35 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.34 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_oai-0.0.3 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.33 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
enju_circulation-0.0.32 spec/dummy/lib/enju_leaf/expire_editable_fragment.rb