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.5555 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5551 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5549 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5544 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5532 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5525 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5519 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5516 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5510 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5507 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5505 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5501 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5497 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5480 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5478 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5472 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5470 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5469 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5468 lib/types/private/types/type_alias.rb
sorbet-runtime-0.5.5461 lib/types/private/types/type_alias.rb