Sha256: 076528a6f4cbe5a48c203e9bac34baeb54d07fbceb9b36105c2f68cf879c6714

Contents?: true

Size: 1.23 KB

Versions: 13

Compression:

Stored size: 1.23 KB

Contents

module Rabl
  class Digestor < ActionView::Digestor
    # Override the original digest function to ignore partial which
    # rabl doesn't use the Rails conventional _ symbol.
    if Gem::Version.new(Rails.version) >= Gem::Version.new('4.1')
      def self.digest(options = {})
        cache_key = [options[:name]] + Array.wrap(options[:dependencies])
        @@cache[cache_key.join('.')] ||= begin
          Digestor.new({ :name => options[:name], :finder => options[:finder] }.merge!(options)).digest
        end
      end
    else
      def self.digest(name, format, finder, options = {})
        cache_key = [name, format] + Array.wrap(options[:dependencies])
        @@cache[cache_key.join('.')] ||= begin
          Digestor.new(name, format, finder, options).digest
        end
      end
    end

    private
      def dependency_digest
        template_digests = (dependencies - [template.virtual_path]).collect do |template_name|
          if Gem::Version.new(Rails.version) >= Gem::Version.new('4.1')
            Digestor.digest(:name => template_name, :finder => finder)
          else
            Digestor.digest(template_name, format, finder)
          end
        end

        (template_digests + injected_dependencies).join("-")
      end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
rabl-0.12.0 lib/rabl/digestor.rb
rabl-0.11.8 lib/rabl/digestor.rb
rabl-0.11.7 lib/rabl/digestor.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/rabl-0.11.6/lib/rabl/digestor.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/rabl-0.11.6/lib/rabl/digestor.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/rabl-0.11.6/lib/rabl/digestor.rb
rabl-0.11.6 lib/rabl/digestor.rb
rabl-0.11.5 lib/rabl/digestor.rb
rabl-0.11.4 lib/rabl/digestor.rb
rabl-0.11.3 lib/rabl/digestor.rb
rabl-0.11.2 lib/rabl/digestor.rb
rabl-0.11.1 lib/rabl/digestor.rb
rabl-0.11.0 lib/rabl/digestor.rb