Class: ASIR::Coder::Zlib
- Inherits:
-
ASIR::Coder
- Object
- ASIR::Coder
- ASIR::Coder::Zlib
- Defined in:
- lib/asir/coder/zlib.rb
Instance Attribute Summary collapse
-
#compression_level ⇒ Object
Returns the value of attribute compression_level.
Attributes included from Log
Instance Method Summary collapse
Methods inherited from ASIR::Coder
#_subclass_responsibility, #decode, #encode, #prepare
Methods included from Log
#_log, #_log_enabled=, #_log_enabled?, #_log_format, #_log_result, enabled, enabled=, included
Methods included from Initialization
Instance Attribute Details
#compression_level ⇒ Object
Returns the value of attribute compression_level.
8 9 10 |
# File 'lib/asir/coder/zlib.rb', line 8 def compression_level @compression_level end |
Instance Method Details
#_decode(obj) ⇒ Object
14 15 16 17 |
# File 'lib/asir/coder/zlib.rb', line 14 def _decode obj raise TypeError unless String === obj ::Zlib::Inflate.inflate(obj) end |
#_encode(obj) ⇒ Object
10 11 12 13 |
# File 'lib/asir/coder/zlib.rb', line 10 def _encode obj raise TypeError unless String === obj ::Zlib::Deflate.deflate(obj, @compression_level || ::Zlib::DEFAULT_COMPRESSION) end |