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.5181 lib/types/private/types/void.rb
sorbet-runtime-0.5.5179 lib/types/private/types/void.rb
sorbet-runtime-0.5.5176 lib/types/private/types/void.rb
sorbet-runtime-0.5.5175 lib/types/private/types/void.rb
sorbet-runtime-0.4.5173 lib/types/private/types/void.rb
sorbet-runtime-0.4.5168 lib/types/private/types/void.rb
sorbet-runtime-0.4.5163 lib/types/private/types/void.rb
sorbet-runtime-0.4.5158 lib/types/private/types/void.rb
sorbet-runtime-0.4.5146 lib/types/private/types/void.rb
sorbet-runtime-0.4.5144 lib/types/private/types/void.rb
sorbet-runtime-0.4.5140 lib/types/private/types/void.rb
sorbet-runtime-0.4.5136 lib/types/private/types/void.rb
sorbet-runtime-0.4.5135 lib/types/private/types/void.rb
sorbet-runtime-0.4.5133 lib/types/private/types/void.rb
sorbet-runtime-0.4.5129 lib/types/private/types/void.rb
sorbet-runtime-0.4.5109 lib/types/private/types/void.rb
sorbet-runtime-0.4.5099 lib/types/private/types/void.rb
sorbet-runtime-0.4.5095 lib/types/private/types/void.rb
sorbet-runtime-0.4.5085 lib/types/private/types/void.rb
sorbet-runtime-0.4.5083 lib/types/private/types/void.rb