Skip to content

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants