Class: Vedeu::Output::Compressors::Empty Private

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/output/compressors/empty.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.

The empty compressor removes all empty cells.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

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>)


23
24
25
# File 'lib/vedeu/output/compressors/empty.rb', line 23

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.



41
42
43
# File 'lib/vedeu/output/compressors/empty.rb', line 41

def content
  @content
end

Class Method Details

.with(content) ⇒ Array

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:

  • (Array)


17
18
19
# File 'lib/vedeu/output/compressors/empty.rb', line 17

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

Instance Method Details

#compressArray

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:

  • (Array)


28
29
30
31
32
33
34
35
# File 'lib/vedeu/output/compressors/empty.rb', line 28

def compress
  Vedeu.timer('Removing empty cells...') do
    content.reject { |cell| cell.class == Vedeu::Cells::Empty }
  end.tap do |out|
    Vedeu.log(type:    :compress,
              message: "#{message} -> #{out.size} objects")
  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)


46
47
48
# File 'lib/vedeu/output/compressors/empty.rb', line 46

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