Sha256: 625c1b25989edf4c590f7ae5c4670f13cb20920fb37f31df23b8a32052599416

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 Bytes

Contents

module Zeamays
  class Cob
    module Defreezing
      def unpack(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
        unpack(freezed).each do |row|
          cob.grow!(row)
        end
        cob
      end

      private
      def tail_pattern
        'a*'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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