Module: NewRelic::Agent::NewRelicService::Encoders::Compressed::Gzip
- Defined in:
- lib/new_relic/agent/new_relic_service/encoders.rb
Constant Summary collapse
- BINARY =
'BINARY'.freeze
Class Method Summary collapse
Class Method Details
.encode(data, opts = nil) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/new_relic/agent/new_relic_service/encoders.rb', line 30 def self.encode(data, opts = nil) output = StringIO.new output.set_encoding(BINARY) gz = Zlib::GzipWriter.new(output, Zlib::DEFAULT_COMPRESSION, Zlib::DEFAULT_STRATEGY) gz.write(data) gz.close output.rewind output.string end |