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.5779 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5777 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5772 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5767 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5765 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5756 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5753 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5745 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5742 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5737 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5734 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5730 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5725 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5716 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5713 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5703 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5685 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5676 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5675 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5669 lib/types/private/types/type_alias.rb