Sha256: fc636df2ccbaf5509d9306e69be347855dcf70f8f8ef480a3660e4a83509429b

Contents?: true

Size: 539 Bytes

Versions: 10

Compression:

Stored size: 539 Bytes

Contents

module Finitio
  module CollectionType

    def initialize(elm_type, name = nil, metadata = nil)
      unless elm_type.is_a?(Type)
        raise ArgumentError, "Finitio::Type expected, got `#{elm_type}`"
      end

      super(name, metadata)
      @elm_type = elm_type
    end
    attr_reader :elm_type

    def ==(other)
      super || (other.is_a?(self.class) && elm_type == other.elm_type)
    end
    alias :eql? :==

    def hash
      self.class.hash ^ self.elm_type.hash
    end

  end # module CollectionType
end # module Finitio

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
finitio-0.7.0 lib/finitio/type/collection_type.rb
finitio-0.7.0.pre.rc4 lib/finitio/type/collection_type.rb
finitio-0.7.0.pre.rc3 lib/finitio/type/collection_type.rb
finitio-0.7.0.pre.rc2 lib/finitio/type/collection_type.rb
finitio-0.7.0.pre.rc1 lib/finitio/type/collection_type.rb
finitio-0.6.1 lib/finitio/type/collection_type.rb
finitio-0.6.0 lib/finitio/type/collection_type.rb
finitio-0.5.2 lib/finitio/type/collection_type.rb
finitio-0.5.1 lib/finitio/type/collection_type.rb
finitio-0.5.0 lib/finitio/type/collection_type.rb