Class: Vedeu::Output::Compressors::Simple Private

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/output/compressors/simple.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A simple compressor which does not compress- it converts each buffer object into a string and returns the resulting blob of text.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Vedeu::Output::Compressors::Simple

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • content (Array<void>)


25
26
27
# File 'lib/vedeu/output/compressors/simple.rb', line 25

def initialize(content)
  @content = content
end

Instance Attribute Details

#contentvoid (readonly, protected)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.



43
44
45
# File 'lib/vedeu/output/compressors/simple.rb', line 43

def content
  @content
end

Class Method Details

.with(content) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • content (Array<void>)

Returns:

  • (String)


19
20
21
# File 'lib/vedeu/output/compressors/simple.rb', line 19

def self.with(content)
  new(content).compress
end

Instance Method Details

#compressString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


30
31
32
33
34
35
36
37
# File 'lib/vedeu/output/compressors/simple.rb', line 30

def compress
  Vedeu.timer('Stringifying cells...') do
    content.map(&:to_s).join
  end.tap do |out|
    Vedeu.log(type:    :compress,
              message: "#{message} -> #{out.size} characters")
  end
end

#messageString (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


48
49
50
# File 'lib/vedeu/output/compressors/simple.rb', line 48

def message
  "Compression for #{content.size} objects"
end