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.



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

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).with
end

Instance Method Details

#compressString (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)


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

def compress
  @_compress ||= content.map(&:to_s).join
end

#compress_sizeFixnum (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:

  • (Fixnum)


52
53
54
# File 'lib/vedeu/output/compressors/simple.rb', line 52

def compress_size
  compress.size
end

#original_sizeFixnum (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:

  • (Fixnum)


57
58
59
# File 'lib/vedeu/output/compressors/simple.rb', line 57

def original_size
  content.size
end

#withString

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
# File 'lib/vedeu/output/compressors/simple.rb', line 30

def with
  Vedeu.log(type:    :compress,
            message: "No compression for #{original_size} objects -> " \
                     "#{compress_size} characters")

  compress
end