Class: Leeroy::Types::PackedString
- Inherits:
-
String
- Object
- String
- Leeroy::Types::PackedString
- Includes:
- Helpers::Dumpable
- Defined in:
- lib/leeroy/types/packedstring.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes included from Helpers::Dumpable
Instance Method Summary collapse
- #pack(input = self.to_s) ⇒ Object (also: #dumper)
- #unpack(input = self.to_s) ⇒ Object (also: #extract)
Methods included from Helpers::Dumpable
Instance Method Details
#pack(input = self.to_s) ⇒ Object Also known as: dumper
12 13 14 |
# File 'lib/leeroy/types/packedstring.rb', line 12 def pack(input = self.to_s) Base64.urlsafe_encode64(Zlib::Deflate.deflate(input)) end |
#unpack(input = self.to_s) ⇒ Object Also known as: extract
16 17 18 |
# File 'lib/leeroy/types/packedstring.rb', line 16 def unpack(input = self.to_s) Zlib::Inflate.inflate(Base64.urlsafe_decode64(input)) end |