Class: Vedeu::Templating::Decoder Private
- Inherits:
-
Object
- Object
- Vedeu::Templating::Decoder
- Defined in:
- lib/vedeu/templating/decoder.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 encoded string back into an object or collection of objects.
Instance Attribute Summary collapse
- #data ⇒ String readonly protected private
Class Method Summary collapse
- .process(data) ⇒ Object private
Instance Method Summary collapse
-
#decode64 ⇒ String
private
private
Decode the Base64 string into a compressed, marshalled object or objects.
-
#decompress ⇒ String
private
private
Decompress the marshalled object or objects.
-
#demarshal ⇒ Object
private
private
Convert the marshalled object or objects back into an object(s).
-
#initialize(data) ⇒ Vedeu::Templating::Decoder
constructor
private
Returns a new instance of Vedeu::Templating::Decoder.
-
#process ⇒ Object
private
Converts an encoded string back into an object or collection of objects.
-
#unwrap ⇒ String
private
private
Removes delimiters from the start and end of the data.
Constructor Details
#initialize(data) ⇒ Vedeu::Templating::Decoder
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::Decoder.
24 25 26 |
# File 'lib/vedeu/templating/decoder.rb', line 24 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ String (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/decoder.rb', line 40 def data @data end |
Class Method Details
.process(data) ⇒ Object
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/decoder.rb', line 16 def self.process(data) new(data).process end |
Instance Method Details
#decode64 ⇒ 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.
Decode the Base64 string into a compressed, marshalled object or objects.
63 64 65 |
# File 'lib/vedeu/templating/decoder.rb', line 63 def decode64 Base64.strict_decode64(unwrap) end |
#decompress ⇒ 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.
Decompress the marshalled object or objects.
55 56 57 |
# File 'lib/vedeu/templating/decoder.rb', line 55 def decompress Zlib::Inflate.inflate(decode64) end |
#demarshal ⇒ Object (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 marshalled object or objects back into an object(s).
48 49 50 |
# File 'lib/vedeu/templating/decoder.rb', line 48 def demarshal Marshal.load(decompress) end |
#process ⇒ Object
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 encoded string back into an object or collection of objects.
32 33 34 |
# File 'lib/vedeu/templating/decoder.rb', line 32 def process demarshal end |
#unwrap ⇒ 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.
Removes delimiters from the start and end of the data.
70 71 72 |
# File 'lib/vedeu/templating/decoder.rb', line 70 def unwrap data.gsub(/({{)|(}})/, '') end |