zlib
zlib copied to clipboard
Alias Zlib.deflate as Zlib.dump and Zlib.inflate as Zlib.load
load and dump are a very popular naming convention for serializer and such, and defining them allows easy composition.
Example:
class CoderChain
def initialize(*coders)
@coders = coders.flatten
end
def dump(object)
payload = object
@coders.each { |c| payload = c.dump(payload) }
payload
end
def load(payload)
object = payload
@coders.reverse_each { |c| object = c.load(object) }
object
end
end
CoderChain.new(Marshal, Zlib)
CoderChain.new(YAML, Snappy)
I'm +1 to this change.
@akr Do you have any concerns this? I'm not sure what a background of zlib interface.
?
It's just spam.
I banned Justman10000 from our organization.