Method: YARD::Server::Commands::Base#cache
- Defined in:
- lib/yard/server/commands/base.rb
permalink #cache(data) ⇒ String (protected)
Override this method to implement custom caching mechanisms for
159 160 161 162 163 164 165 166 167 168 |
# File 'lib/yard/server/commands/base.rb', line 159 def cache(data) if caching && adapter.document_root path = File.join(adapter.document_root, request.path.sub(/\.html$/, '') + '.html') path = path.sub(%r{/\.html$}, '.html') FileUtils.mkdir_p(File.dirname(path)) log.debug "Caching data to #{path}" File.open(path, 'wb') {|f| f.write(data) } end self.body = data end |