Class: CoderDecorator::Coders::Zip

Inherits:
Coder
  • Object
show all
Defined in:
lib/coder_decorator/coders/zip.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Coder

Coder::DELEGATE

Instance Method Summary collapse

Methods inherited from Coder

#coder, #initialize

Constructor Details

This class inherits a constructor from CoderDecorator::Coders::Coder

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CoderDecorator::Coders::Coder

Instance Method Details

#decode(str) ⇒ Object



11
12
13
14
15
# File 'lib/coder_decorator/coders/zip.rb', line 11

def decode(str)
  coder.decode(::Zlib::Inflate.inflate(str))
rescue ::Zlib::DataError
  raise InvalidEncoding
end

#encode(str) ⇒ Object



7
8
9
# File 'lib/coder_decorator/coders/zip.rb', line 7

def encode(str)
  ::Zlib::Deflate.deflate(coder.encode(str))
end