Sha256: e2d2a586d9705841f4d0d4db96a6f875128a02f0dba187f80741b324911ba950

Contents?: true

Size: 764 Bytes

Versions: 10

Compression:

Stored size: 764 Bytes

Contents

module Hanko
  class Init
    def initialize(digest_class = nil)
      @digest_class = digest_class
    end

    def ready
      Hanko::Fingerprint.digest_class = @digest_class if @digest_class

      if exist_asset_paths?
        prepend_asset_paths
      else
        prepend_asset_url_helper
      end
    end

    def prepend_asset_url_helper
      require "hanko/asset_url_helper"
      ActionView::Base.__send__(
        :prepend, Hanko::AssetUrlHelper
      )
    end

    def prepend_asset_paths
      require "hanko/asset_paths"
      ActionView::Helpers::AssetTagHelper::AssetPaths.__send__(
        :prepend, Hanko::AssetPaths
      )
    end

    def exist_asset_paths?
      defined?(ActionView::Helpers::AssetTagHelper::AssetPaths)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hanko-0.2.2 lib/hanko/init.rb
hanko-0.2.1 lib/hanko/init.rb
hanko-0.2.0 lib/hanko/init.rb
hanko-0.1.6 lib/hanko/init.rb
hanko-0.1.5 lib/hanko/init.rb
hanko-0.1.4 lib/hanko/init.rb
hanko-0.1.3 lib/hanko/init.rb
hanko-0.1.2 lib/hanko/init.rb
hanko-0.1.1 lib/hanko/init.rb
hanko-0.1.0 lib/hanko/init.rb