Class: Vedeu::Templating::Encoder Private
- Inherits:
-
Object
- Object
- Vedeu::Templating::Encoder
- Defined in:
- lib/vedeu/templating/encoder.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.
Converts an object or collection of objects into an encoded String.
Instance Attribute Summary collapse
- #data ⇒ Object readonly protected private
Class Method Summary collapse
- .process(data) ⇒ String private
Instance Method Summary collapse
-
#compress ⇒ String
private
private
Compress the marshalled object or objects.
-
#encode64 ⇒ String
private
private
Encode the compressed, marshalled object or objects into a Base64 string.
-
#initialize(data) ⇒ Vedeu::Templating::Encoder
constructor
private
Returns a new instance of Vedeu::Templating::Encoder.
-
#marshal ⇒ String
private
private
Convert the object or objects into marshalled object(s).
-
#process ⇒ String
private
Converts an object or collection of objects into an encoded String.
-
#wrap ⇒ String
private
private
Adds delimiters to the start and end of the data.
Constructor Details
#initialize(data) ⇒ Vedeu::Templating::Encoder
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::Templating::Encoder.
24 25 26 |
# File 'lib/vedeu/templating/encoder.rb', line 24 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (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.
40 41 42 |
# File 'lib/vedeu/templating/encoder.rb', line 40 def data @data end |
Class Method Details
.process(data) ⇒ 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.
16 17 18 |
# File 'lib/vedeu/templating/encoder.rb', line 16 def self.process(data) new(data).process end |
Instance Method Details
#compress ⇒ String (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.
Compress the marshalled object or objects.
62 63 64 |
# File 'lib/vedeu/templating/encoder.rb', line 62 def compress Zlib::Deflate.deflate(marshal) end |
#encode64 ⇒ String (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.
Encode the compressed, marshalled object or objects into a Base64 string.
55 56 57 |
# File 'lib/vedeu/templating/encoder.rb', line 55 def encode64 Base64.strict_encode64(compress) end |
#marshal ⇒ String (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.
Convert the object or objects into marshalled object(s).
69 70 71 |
# File 'lib/vedeu/templating/encoder.rb', line 69 def marshal Marshal.dump(data) end |
#process ⇒ 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.
Converts an object or collection of objects into an encoded String.
32 33 34 |
# File 'lib/vedeu/templating/encoder.rb', line 32 def process wrap end |
#wrap ⇒ String (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.
Adds delimiters to the start and end of the data.
47 48 49 |
# File 'lib/vedeu/templating/encoder.rb', line 47 def wrap "{{#{encode64}}}" end |