class MassEncryption::BatchSerializer
Public Instance Methods
deserialize(hash)
click to toggle source
# File lib/mass_encryption/batch_serializer.rb, line 16 def deserialize(hash) MassEncryption::Batch.new(klass: hash["klass"].constantize, from_id: hash["from_id"], size: hash["size"], track: hash["track"], tracks_count: hash["tracks_count"]) end
serialize(batch)
click to toggle source
Calls superclass method
# File lib/mass_encryption/batch_serializer.rb, line 6 def serialize(batch) super( "klass" => batch.klass.name, "from_id" => batch.from_id, "size" => batch.size, "track" => batch.track || 0, "tracks_count" => batch.tracks_count || 1 ) end
serialize?(argument)
click to toggle source
# File lib/mass_encryption/batch_serializer.rb, line 2 def serialize?(argument) argument.kind_of?(MassEncryption::Batch) end