Sha256: dc1ac1c09a626512c0dfe2f16f2246b0a2c1bc16844f11cd26b0862cb9e38319

Contents?: true

Size: 547 Bytes

Versions: 10

Compression:

Stored size: 547 Bytes

Contents

module WebFont
  module LocalCache
    class << self
      attr_accessor :cache, :cache_path

      def path(filename)
        path = File.join(cache_path, filename)
        File.exist?(path) ? path : nil
      end

      def save(font)
        return nil unless cache_path

        filename = File.basename(font)
        path     = File.join(cache_path, filename)
        FileUtils.copy(font, path) unless font == path

        path
      end

      def enable?
        cache && !!cache_path && Dir.exist?(cache_path)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
web_font-0.2.0 lib/web_font/local_cache.rb
web_font-0.1.14 lib/web_font/local_cache.rb
web_font-0.1.13 lib/web_font/local_cache.rb
web_font-0.1.12 lib/web_font/local_cache.rb
web_font-0.1.11 lib/web_font/local_cache.rb
web_font-0.1.10 lib/web_font/local_cache.rb
web_font-0.1.9 lib/web_font/local_cache.rb
web_font-0.1.7 lib/web_font/local_cache.rb
web_font-0.1.6 lib/web_font/local_cache.rb
web_font-0.1.5 lib/web_font/local_cache.rb