Class: Vedeu::Output::Compressor Private
- Inherits:
-
Object
- Object
- Vedeu::Output::Compressor
- Includes:
- Common, Renderers::Options
- Defined in:
- lib/vedeu/output/compressor.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.
During the conversion of a Vedeu::Cells::Char object into a string of escape sequences, this class removes multiple occurences of the same escape sequence, resulting in a smaller payload being sent to the renderer.
Instance Attribute Summary collapse
- #output ⇒ Array<Array<Vedeu::Cells::Char>> readonly protected private
Attributes included from Renderers::Options
Class Method Summary collapse
Instance Method Summary collapse
-
#content ⇒ Array
private
private
Returns the output with all of the empty cells removed to make compression faster.
-
#initialize(output, options = {}) ⇒ Vedeu::Output::Compressor
constructor
private
Returns a new instance of Vedeu::Output::Compressor.
- #output? ⇒ Boolean private private
- #render ⇒ String, Array<void>|String private
Methods included from Renderers::Options
#clear, #compression, #compression?, #default_template, #defaults, #end_row_tag, #end_tag, #filename, #start_row_tag, #start_tag, #template, #timestamp, #timestamp?, #write, #write_file, #write_file?
Methods included from Common
#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?
Constructor Details
#initialize(output, options = {}) ⇒ Vedeu::Output::Compressor
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 a new instance of Vedeu::Output::Compressor.
31 32 33 34 |
# File 'lib/vedeu/output/compressor.rb', line 31 def initialize(output, = {}) @output = output @options = end |
Instance Attribute Details
#output ⇒ Array<Array<Vedeu::Cells::Char>> (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.
51 52 53 |
# File 'lib/vedeu/output/compressor.rb', line 51 def output @output end |
Class Method Details
.render(output, options = {}) ⇒ String, Array<void>|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.
21 22 23 |
# File 'lib/vedeu/output/compressor.rb', line 21 def self.render(output, = {}) new(output, ).render end |
Instance Method Details
#content ⇒ Array (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 the output with all of the empty cells removed to make compression faster.
59 60 61 |
# File 'lib/vedeu/output/compressor.rb', line 59 def content Vedeu::Output::Compressors::Empty.with(output.content) end |
#output? ⇒ Boolean (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.
64 65 66 |
# File 'lib/vedeu/output/compressor.rb', line 64 def output? present?(output) end |
#render ⇒ String, Array<void>|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.
-
Takes approximately ~6ms for 2100 chars. (2015-11-25)
-
Takes approximately ~25ms for 2100 chars. (2015-07-25)
41 42 43 44 45 |
# File 'lib/vedeu/output/compressor.rb', line 41 def render return [] unless output? Vedeu::Output::CompressorCache.cache(content, compression?) end |