Sha256: 7c5ad45078cd8d5029a96a33baf294c2f2da43be766c674e1bd2da80e60e39a1

Contents?: true

Size: 818 Bytes

Versions: 414

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true
# typed: true

# A marking class for when methods return void.
# Should never appear in types directly.
class T::Private::Types::Void < T::Types::Base
  ERROR_MESSAGE = "Validation is being done on an `Void`. Please report to #dev-productivity."

  # The actual return value of `.void` methods.
  #
  # Uses `Module.new` because in Ruby an anonymous module will inherit the name
  # of the constant it's assigned to. This gives it a readable name someone
  # examines it in Pry or with `#inspect` like:
  #
  #     T::Private::Types::Void::VOID
  #
  VOID = Module.new.freeze

  # @override Base
  def name
    "<VOID>"
  end

  # @override Base
  def valid?(obj)
    raise ERROR_MESSAGE
  end

  # @override Base
  private def subtype_of_single?(other)
    raise ERROR_MESSAGE
  end
end

Version data entries

414 entries across 414 versions & 1 rubygems

Version Path
sorbet-runtime-0.5.5316 lib/types/private/types/void.rb
sorbet-runtime-0.5.5313 lib/types/private/types/void.rb
sorbet-runtime-0.5.5308 lib/types/private/types/void.rb
sorbet-runtime-0.5.5295 lib/types/private/types/void.rb
sorbet-runtime-0.5.5284 lib/types/private/types/void.rb
sorbet-runtime-0.5.5281 lib/types/private/types/void.rb
sorbet-runtime-0.5.5278 lib/types/private/types/void.rb
sorbet-runtime-0.5.5267 lib/types/private/types/void.rb
sorbet-runtime-0.5.5265 lib/types/private/types/void.rb
sorbet-runtime-0.5.5262 lib/types/private/types/void.rb
sorbet-runtime-0.5.5258 lib/types/private/types/void.rb
sorbet-runtime-0.5.5255 lib/types/private/types/void.rb
sorbet-runtime-0.5.5247 lib/types/private/types/void.rb
sorbet-runtime-0.5.5238 lib/types/private/types/void.rb
sorbet-runtime-0.5.5226 lib/types/private/types/void.rb
sorbet-runtime-0.5.5213 lib/types/private/types/void.rb
sorbet-runtime-0.5.5207 lib/types/private/types/void.rb
sorbet-runtime-0.5.5200 lib/types/private/types/void.rb
sorbet-runtime-0.5.5188 lib/types/private/types/void.rb
sorbet-runtime-0.5.5182 lib/types/private/types/void.rb