Sha256: ed903e656f66ca3b4c56e391f9913e4d8719f68c4cc6e587dc911b8fd4310000

Contents?: true

Size: 618 Bytes

Versions: 15

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

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

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

    # overrides 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

15 entries across 15 versions & 1 rubygems

Version Path
sorbet-runtime-0.5.9248 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9242 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9238 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9230 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9226 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9222 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9219 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9218 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9211 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9209 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9204 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9195 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9189 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9182 lib/types/types/typed_set.rb
sorbet-runtime-0.5.9174 lib/types/types/typed_set.rb