Sha256: 93f09d8648af15eb252cb38941630677389ab27a231264975679b0eddc562141

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

module Zeamays
  class Cob
    module Freezing
      def pack
        @rows.collect { |row|
          row.pack(self.class.package_pattern)
        }.join("")
      end
      alias freeze pack
      alias freezed pack

      module ClassMethods
        def package_pattern
          gene_sequence.map { |type|
            case type
              when :i8 then 'C'
              when :i16 then 'n'
              when :i32 then 'N'
              when :integer then 'N'
              when :string then 'Z*'
            end
          }.join("")
        end
      end

      def self.included(me)
        me.extend ClassMethods
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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