Class: Fluent::Plugin::GzipParser

Inherits:
Parser
  • Object
show all
Defined in:
lib/fluent/plugin/parser_gzip.rb

Instance Method Summary collapse

Instance Method Details

#compress(string, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/fluent/plugin/parser_gzip.rb', line 21

def compress(string, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY)
  output = Stream.new
  gz = Zlib::GzipWriter.new(output, level, strategy)
  gz.write(string)
  gz.close
  output.string
end

#configure(conf) ⇒ Object



10
11
12
# File 'lib/fluent/plugin/parser_gzip.rb', line 10

def configure(conf)
  super
end

#parse(text) {|x| ... } ⇒ Object

Yields:

  • (x)


14
15
16
17
18
19
# File 'lib/fluent/plugin/parser_gzip.rb', line 14

def parse(text)
  log.debug("Parsing: #{text}")
  x = compress(text)
  log.debug("After compress: #{x}")
  yield x
end