Sha256: 70407a2caafc3eae16e895a032e77ea94d2b834ba304900d8f43bb7e64aa612e

Contents?: true

Size: 618 Bytes

Versions: 232

Compression:

Stored size: 618 Bytes

Contents

# frozen_string_literal: true
# typed: true

module T::Types
  class TypedSet < TypedEnumerable
    attr_reader :type

    def underlying_class
      Hash
    end

    # @override Base
    def name
      "T::Set[#{@type.name}]"
    end

    # @override Base
    def recursively_valid?(obj)
      obj.is_a?(Set) && super
    end

    # @override Base
    def valid?(obj)
      obj.is_a?(Set)
    end

    def new(*args)
      Set.new(*T.unsafe(args))
    end

    class Untyped < TypedSet
      def initialize
        super(T.untyped)
      end

      def valid?(obj)
        obj.is_a?(Set)
      end
    end
  end
end

Version data entries

232 entries across 232 versions & 1 rubygems

Version Path
sorbet-runtime-0.5.9172 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9167 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9163 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9161 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9158 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9155 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9154 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9152 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9151 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9147 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9139 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9133 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9130 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9125 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9120 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9115 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9112 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9105 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9104 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9103 lib/types/types/typed_set.rb