Sha256: d800108ae073fcd456b24bae0194fa34f5cf3ec0abc5bd897146482261fd1962

Contents?: true

Size: 520 Bytes

Versions: 4

Compression:

Stored size: 520 Bytes

Contents

module YARD
  module Server
    module StaticCaching
      def check_static_cache
        return nil unless adapter.document_root
        cache_path = File.join(adapter.document_root, request.path.sub(/\.html$/, '') + '.html')
        cache_path = cache_path.sub(%r{/\.html$}, '.html')
        if File.file?(cache_path)
          log.debug "Loading cache from disk: #{cache_path}"
          return [200, {'Content-Type' => 'text/html'}, [File.read_binary(cache_path)]]
        end
        nil
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yard-0.6.3 lib/yard/server/static_caching.rb
yard-0.6.2 lib/yard/server/static_caching.rb
yard-0.6.1 lib/yard/server/static_caching.rb
yard-0.6.0 lib/yard/server/static_caching.rb