Sha256: ad5641e8819cb7faec6d708484ec2b895b410821140ee73a012bf546213bed64

Contents?: true

Size: 421 Bytes

Versions: 12

Compression:

Stored size: 421 Bytes

Contents

module Conglomerate
  class Array
    include Enumerable

    def initialize(type)
      self.type = type
      self.storage = []
    end

    def <<(val)
      if type
        raise "TypeMismatch" unless val.is_a?(type)
      end

      storage << val
    end

    def empty?
      storage.empty?
    end

    def each(&block)
      storage.each(&block)
    end

    private

    attr_accessor :storage, :type
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
conglomerate-0.16.0 lib/conglomerate/array.rb
conglomerate-0.15.0 lib/conglomerate/array.rb
conglomerate-0.14.0 lib/conglomerate/array.rb
conglomerate-0.13.0 lib/conglomerate/array.rb
conglomerate-0.12.1 lib/conglomerate/array.rb
conglomerate-0.12.0 lib/conglomerate/array.rb
conglomerate-0.11.1 lib/conglomerate/array.rb
conglomerate-0.11.0 lib/conglomerate/array.rb
conglomerate-0.10.0 lib/conglomerate/array.rb
conglomerate-0.9.0 lib/conglomerate/array.rb
conglomerate-0.8.1 lib/conglomerate/array.rb
conglomerate-0.8.0 lib/conglomerate/array.rb