class ScoutApm::Utils::GzipHelper

A simple wrapper around Ruby's built-in gzip support.

Constants

DEFAULT_GZIP_LEVEL

Attributes

level[R]

Public Class Methods

new(level = DEFAULT_GZIP_LEVEL) click to toggle source
# File lib/scout_apm/utils/gzip_helper.rb, line 9
def initialize(level = DEFAULT_GZIP_LEVEL)
  @level = level
end

Public Instance Methods

deflate(str) click to toggle source
# File lib/scout_apm/utils/gzip_helper.rb, line 13
def deflate(str)
  strio = StringIO.new

  gz = Zlib::GzipWriter.new(strio, level)
  gz.write str
  gz.close

  strio.string
end