module Sprockets::EncodingUtils
def unmarshaled_deflated(str, window_bits = -Zlib::MAX_WBITS)
window_bits - Integer deflate window size. See ZLib::Inflate.new()
str - Marshaled String
otherwise inflate the data an unmarshal.
Checks leading marshal header to see if the bytes are uncompressed
Internal: Unmarshal optionally deflated data.
def unmarshaled_deflated(str, window_bits = -Zlib::MAX_WBITS) major, minor = str[0], str[1] if major && major.ord == Marshal::MAJOR_VERSION && minor && minor.ord <= Marshal::MINOR_VERSION marshaled = str else begin marshaled = Zlib::Inflate.new(window_bits).inflate(str) rescue Zlib::DataError marshaled = str end end Marshal.load(marshaled) end