Sha256: 657bf7368613b8f9532478d278aabac2a7d3be95bdde5ace1aa97cbd3e75d101

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

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

      def freeze
        pack
      end
      def freezed
        pack
      end

      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.6 lib/zeamays/cob/freezing.rb