Advertisement
Guest User

Untitled

a guest
Jan 17th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.37 KB | None | 0 0
  1. def cache_bust(target)
  2.   class << @site
  3.     attr_accessor :cache_bust_map
  4.   end
  5.   @site.cache_bust_map ||= {}
  6.   if target.is_a? String
  7.     target = @items[target]
  8.   end
  9.   checksum = target.checksum
  10.   @site.cache_bust_map[checksum] ||= begin
  11.     require 'xxhash'
  12.     relativize_path(target) + "?#{XXhash.xxh32(target.compiled_content, checksum.to_i)}"
  13.   end
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement