Class: ScoutApm::Utils::GzipHelper
- Inherits:
-
Object
- Object
- ScoutApm::Utils::GzipHelper
- Defined in:
- lib/scout_apm/utils/gzip_helper.rb
Overview
A simple wrapper around Ruby’s built-in gzip support.
Constant Summary collapse
- DEFAULT_GZIP_LEVEL =
5
Instance Attribute Summary collapse
-
#level ⇒ Object
readonly
Returns the value of attribute level.
Instance Method Summary collapse
- #deflate(str) ⇒ Object
-
#initialize(level = DEFAULT_GZIP_LEVEL) ⇒ GzipHelper
constructor
A new instance of GzipHelper.
Constructor Details
#initialize(level = DEFAULT_GZIP_LEVEL) ⇒ GzipHelper
Returns a new instance of GzipHelper.
9 10 11 |
# File 'lib/scout_apm/utils/gzip_helper.rb', line 9 def initialize(level = DEFAULT_GZIP_LEVEL) @level = level end |
Instance Attribute Details
#level ⇒ Object (readonly)
Returns the value of attribute level.
7 8 9 |
# File 'lib/scout_apm/utils/gzip_helper.rb', line 7 def level @level end |
Instance Method Details
#deflate(str) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# 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 |