Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alias Zlib.deflate as Zlib.dump and Zlib.inflate as Zlib.load #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

casperisfine
Copy link

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)

`load` and `dump` are a very popular naming convention for
serializer and such, and defining them allows easy composition.
@hsbt
Copy link
Member

hsbt commented Jan 5, 2022

I'm +1 to this change.

@akr Do you have any concerns this? I'm not sure what a background of zlib interface.

@casperisfine
Copy link
Author

?

@hsbt
Copy link
Member

hsbt commented Sep 12, 2023

It's just spam.

@hsbt
Copy link
Member

hsbt commented Sep 13, 2023

I banned Justman10000 from our organization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants