Module: Ritm::Encodings
- Defined in:
- lib/ritm/helpers/encodings.rb
Constant Summary collapse
- ENCODINGS =
%i[identity gzip deflate].freeze
Class Method Summary collapse
Class Method Details
.decode(encoding, data) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ritm/helpers/encodings.rb', line 20 def self.decode(encoding, data) case encoding when :gzip decode_gzip(data) when :deflate decode_deflate(data) when :identity identity(data) else raise "Unsupported encoding #{encoding}" end end |
.encode(encoding, data) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ritm/helpers/encodings.rb', line 7 def self.encode(encoding, data) case encoding when :gzip encode_gzip(data) when :deflate encode_deflate(data) when :identity identity(data) else raise "Unsupported encoding #{encoding}" end end |