Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 14 additions & 36 deletions stdlib/singleton/0/singleton.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -90,48 +90,26 @@
# p a.strip # => nil
#
module Singleton
def self.__init__: (Class klass) -> Class

# <!--
# rdoc-file=lib/singleton.rb
# - instance()
# -->
# Returns the singleton instance.
#
def self.instance: () -> instance

# <!--
# rdoc-file=lib/singleton.rb
# - _dump(depth = -1)
# -->
# By default, do not retain any state when marshalling.
# <!-- rdoc-file=lib/singleton.rb -->
# The version string
#
def _dump: (?Integer depth) -> String
VERSION: String

# <!--
# rdoc-file=lib/singleton.rb
# - clone()
# -->
# Raises a TypeError to prevent cloning.
#
def clone: () -> bot
module SingletonInstanceMethods
def clone: () -> bot

# <!--
# rdoc-file=lib/singleton.rb
# - dup()
# -->
# Raises a TypeError to prevent duping.
#
def dup: () -> bot
def dup: () -> bot

module SingletonInstanceMethods
def _dump: (?Integer depth) -> String
end
include SingletonInstanceMethods

module SingletonClassMethods
def instance: () -> instance
end
end

# <!-- rdoc-file=lib/singleton.rb -->
# The version string
#
Singleton::VERSION: String
module SingletonClassProperties
def __init__: (Class klass) -> Class
end
extend SingletonClassProperties
end
5 changes: 0 additions & 5 deletions test/stdlib/singleton_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ class TestClass
include Singleton
end

def test_instance
assert_send_type '() -> SingletonSingletonTest::TestClass',
TestClass, :instance
end

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test will fail, but making it pass requires breaking changes to the test harness.

def test_singleton_instance_methods
omit "SingletonInstanceMethods is not available" unless Singleton.const_defined?(:SingletonInstanceMethods, false)

Expand Down
Loading