Sha256: ba81ff58cd7dc5b4b3407abc8963ad3cf17031e50bce10c5b0bcc5a922a86c4c

Contents?: true

Size: 668 Bytes

Versions: 1

Compression:

Stored size: 668 Bytes

Contents

module Zeamays
  class Cob
    module Defreezing
      def deserialized(packed_string)
        unpacked_list = []

        left_string = packed_string
        while left_string.size != 0 do
          unpacked = left_string.unpack(package_pattern + tail_pattern)
          left_string = unpacked.pop
          unpacked_list << unpacked
        end
        unpacked_list
      end

      def defreeze(freezed)
        cob = Cob.new
        deserialized(freezed).each do |row|
          cob.grow!(row)
        end
        cob
      end
      alias unpack defreeze
      alias depack defreeze

      private
      def tail_pattern
        'a*'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zeamays-0.0.7 lib/zeamays/cob/defreezing.rb