Sha256: a39c8c00ee25b39ead05791e328fd38e21187b5b2469d455c139bca6c3a0ed46

Contents?: true

Size: 473 Bytes

Versions: 186

Compression:

Stored size: 473 Bytes

Contents

# frozen_string_literal: true
# typed: true

module T::Private::Types
  # Wraps a proc for a type alias to defer its evaluation.
  class TypeAlias < T::Types::Base

    def initialize(callable)
      @callable = callable
    end

    def aliased_type
      @aliased_type ||= T::Utils.coerce(@callable.call)
    end

    # @override Base
    def name
      aliased_type.name
    end

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

Version data entries

186 entries across 186 versions & 1 rubygems

Version Path
sorbet-runtime-0.5.5843 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5841 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5835 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5830 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5823 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5821 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5820 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5818 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5815 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5813 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5809 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5808 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5803 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5796 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5795 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5794 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5790 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5786 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5784 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5781 lib/types/private/types/type_alias.rb