core/module.rbs in rbs-3.1.3 vs core/module.rbs in rbs-3.2.0.pre.1
- old
+ new
@@ -233,11 +233,11 @@
#
# *produces:*
#
# Exiting with code 99
#
- def alias_method: (::Symbol | ::String new_name, ::Symbol | ::String old_name) -> ::Symbol
+ def alias_method: (id new_name, id old_name) -> ::Symbol
# <!--
# rdoc-file=object.c
# - mod.ancestors -> array
# -->
@@ -282,11 +282,11 @@
# module Mod
# attr_accessor(:one, :two) #=> [:one, :one=, :two, :two=]
# end
# Mod.instance_methods.sort #=> [:one, :one=, :two, :two=]
#
- def attr_accessor: (*Object::name arg0) -> Array[Symbol]
+ def attr_accessor: (*id arg0) -> Array[Symbol]
# <!--
# rdoc-file=object.c
# - attr_reader(symbol, ...) -> array
# - attr(symbol, ...) -> array
@@ -296,22 +296,22 @@
# Creates instance variables and corresponding methods that return the value of
# each instance variable. Equivalent to calling ```attr`*:name*'' on each name
# in turn. String arguments are converted to symbols. Returns an array of
# defined method names as symbols.
#
- def attr_reader: (*Object::name arg0) -> Array[Symbol]
+ def attr_reader: (*id arg0) -> Array[Symbol]
# <!--
# rdoc-file=object.c
# - attr_writer(symbol, ...) -> array
# - attr_writer(string, ...) -> array
# -->
# Creates an accessor method to allow assignment to the attribute
# *symbol*`.id2name`. String arguments are converted to symbols. Returns an
# array of defined method names as symbols.
#
- def attr_writer: (*Object::name arg0) -> Array[Symbol]
+ def attr_writer: (*id arg0) -> Array[Symbol]
# <!--
# rdoc-file=load.c
# - mod.autoload(const, filename) -> nil
# -->
@@ -326,11 +326,11 @@
#
# If *const* in *mod* is defined as autoload, the file name to be loaded is
# replaced with *filename*. If *const* is defined but not as autoload, does
# nothing.
#
- def autoload: (Symbol _module, String filename) -> NilClass
+ def autoload: (id _module, String filename) -> NilClass
# <!--
# rdoc-file=load.c
# - mod.autoload?(name, inherit=true) -> String or nil
# -->
@@ -352,11 +352,11 @@
# end
#
# B.autoload?(:CONST) #=> "const.rb", found in A (ancestor)
# B.autoload?(:CONST, false) #=> nil, not found in B itself
#
- def autoload?: (Symbol name, ?boolish inherit) -> String?
+ def autoload?: (id name, ?boolish inherit) -> String?
# <!-- rdoc-file=vm_eval.c -->
# Evaluates the string or block in the context of *mod*, except that when a
# block is given, constant/class variable lookup is not affected. This can be
# used to add methods to a class. `module_eval` returns the result of evaluating
@@ -410,11 +410,11 @@
# @@foo = 99
# end
# Fred.class_variable_defined?(:@@foo) #=> true
# Fred.class_variable_defined?(:@@bar) #=> false
#
- def class_variable_defined?: (Symbol | String arg0) -> bool
+ def class_variable_defined?: (id arg0) -> bool
# <!--
# rdoc-file=object.c
# - mod.class_variable_get(symbol) -> obj
# - mod.class_variable_get(string) -> obj
@@ -426,11 +426,11 @@
# class Fred
# @@foo = 99
# end
# Fred.class_variable_get(:@@foo) #=> 99
#
- def class_variable_get: (Symbol | String arg0) -> untyped
+ def class_variable_get: (id arg0) -> untyped
# <!--
# rdoc-file=object.c
# - obj.class_variable_set(symbol, obj) -> obj
# - obj.class_variable_set(string, obj) -> obj
@@ -445,11 +445,11 @@
# end
# end
# Fred.class_variable_set(:@@foo, 101) #=> 101
# Fred.new.foo #=> 101
#
- def class_variable_set: (Symbol | String arg0, untyped arg1) -> untyped
+ def class_variable_set: (id arg0, untyped arg1) -> untyped
# <!--
# rdoc-file=object.c
# - mod.class_variables(inherit=true) -> array
# -->
@@ -525,11 +525,11 @@
# If the argument is not a valid constant name a `NameError` is raised with the
# message "wrong constant name *name*":
#
# Hash.const_defined? 'foobar' #=> NameError: wrong constant name foobar
#
- def const_defined?: (Symbol | String name, ?boolish inherit) -> bool
+ def const_defined?: (id name, ?boolish inherit) -> bool
# <!--
# rdoc-file=object.c
# - mod.const_get(sym, inherit=true) -> obj
# - mod.const_get(str, inherit=true) -> obj
@@ -564,11 +564,11 @@
# If the argument is not a valid constant name a `NameError` will be raised with
# a warning "wrong constant name".
#
# Object.const_get 'foobar' #=> NameError: wrong constant name foobar
#
- def const_get: (Symbol | String name, ?boolish inherit) -> untyped
+ def const_get: (id name, ?boolish inherit) -> untyped
# <!--
# rdoc-file=object.c
# - mod.const_missing(sym) -> obj
# -->
@@ -616,11 +616,11 @@
# If `sym` or `str` is not a valid constant name a `NameError` will be raised
# with a warning "wrong constant name".
#
# Object.const_set('foobar', 42) #=> NameError: wrong constant name foobar
#
- def const_set: (Symbol | String arg0, untyped arg1) -> untyped
+ def const_set: (id arg0, untyped arg1) -> untyped
# <!--
# rdoc-file=object.c
# - mod.const_source_location(sym, inherit=true) -> [String, Integer]
# - mod.const_source_location(str, inherit=true) -> [String, Integer]
@@ -666,11 +666,11 @@
# p M.const_source_location('A') # => ["test.rb", 1] -- Object is not ancestor, but additionally checked for modules
#
# p Object.const_source_location('A::C1') # => ["test.rb", 2] -- nesting is supported
# p Object.const_source_location('String') # => [] -- constant is defined in C code
#
- def const_source_location: (Symbol | String name, ?boolish inherit) -> ([ String, Integer ] | [ ] | nil)
+ def const_source_location: (id name, ?boolish inherit) -> ([ String, Integer ] | [ ] | nil)
# <!--
# rdoc-file=object.c
# - mod.constants(inherit=true) -> array
# -->
@@ -724,12 +724,12 @@
# In Fred
# Charge it!
# I'm Dino!
# #<B:0x401b39e8>
#
- def define_method: (Symbol | String arg0, ?Proc | Method | UnboundMethod arg1) -> Symbol
- | (Symbol | String arg0) { () -> untyped } -> Symbol
+ def define_method: (id symbol, Proc | Method | UnboundMethod method) -> Symbol
+ | (id symbol) { () -> untyped } -> Symbol
# <!--
# rdoc-file=object.c
# - mod.deprecate_constant(symbol, ...) => mod
# -->
@@ -744,11 +744,11 @@
# end
#
# HTTP::NOT_FOUND
# # warning: constant HTTP::NOT_FOUND is deprecated
#
- def deprecate_constant: (*Symbol) -> self
+ def deprecate_constant: (*id) -> self
def eql?: (untyped other) -> bool
def equal?: (untyped other) -> bool
@@ -934,11 +934,11 @@
#
# *produces:*
#
# Hello there, Dave!
#
- def instance_method: (Symbol arg0) -> UnboundMethod
+ def instance_method: (id arg0) -> UnboundMethod
# <!--
# rdoc-file=object.c
# - mod.instance_methods(include_super=true) -> array
# -->
@@ -1027,11 +1027,11 @@
# C.method_defined? "method3" #=> true
# C.method_defined? "protected_method1" #=> true
# C.method_defined? "method4" #=> false
# C.method_defined? "private_method2" #=> false
#
- def method_defined?: (Symbol | String name, ?boolish inherit) -> bool
+ def method_defined?: (id name, ?boolish inherit) -> bool
# <!--
# rdoc-file=object.c
# - method_removed(method_name)
# -->
@@ -1145,11 +1145,11 @@
# end
# end
# Mod.one #=> "This is one"
# c.call_one #=> "This is the new one"
#
- def module_function: (*Symbol | String arg0) -> self
+ def module_function: (*id arg0) -> self
# <!--
# rdoc-file=object.c
# - mod.name -> string
# -->
@@ -1244,19 +1244,19 @@
# @me = new(*args, &block) if ! @me
# @me
# end
# end
#
- def private_class_method: (*Symbol | String arg0) -> self
+ def private_class_method: (*id arg0) -> self
# <!--
# rdoc-file=object.c
# - mod.private_constant(symbol, ...) => mod
# -->
# Makes a list of existing constants private.
#
- def private_constant: (*Symbol arg0) -> self
+ def private_constant: (*id arg0) -> self
# <!--
# rdoc-file=object.c
# - mod.private_instance_methods(include_super=true) -> array
# -->
@@ -1299,11 +1299,11 @@
# C.private_method_defined? "method2" #=> true
# C.private_method_defined? "method2", true #=> true
# C.private_method_defined? "method2", false #=> false
# C.method_defined? "method2" #=> false
#
- def private_method_defined?: (Symbol | String name, ?boolish inherit) -> bool
+ def private_method_defined?: (id name, ?boolish inherit) -> bool
# <!--
# rdoc-file=vm_method.c
# - protected -> nil
# - protected(method_name) -> method_name
@@ -1363,11 +1363,11 @@
# C.protected_method_defined? "method2" #=> true
# C.protected_method_defined? "method2", true #=> true
# C.protected_method_defined? "method2", false #=> false
# C.method_defined? "method2" #=> true
#
- def protected_method_defined?: (Symbol | String name, ?boolish inherit) -> bool
+ def protected_method_defined?: (id name, ?boolish inherit) -> bool
# <!--
# rdoc-file=vm_method.c
# - public -> nil
# - public(method_name) -> method_name
@@ -1396,27 +1396,27 @@
# Makes a list of existing class methods public.
#
# String arguments are converted to symbols. An Array of Symbols and/or Strings
# is also accepted.
#
- def public_class_method: (*Symbol | String arg0) -> self
+ def public_class_method: (*id arg0) -> self
# <!--
# rdoc-file=object.c
# - mod.public_constant(symbol, ...) => mod
# -->
# Makes a list of existing constants public.
#
- def public_constant: (*Symbol arg0) -> self
+ def public_constant: (*id arg0) -> self
# <!--
# rdoc-file=proc.c
# - mod.public_instance_method(symbol) -> unbound_method
# -->
# Similar to *instance_method*, searches public method only.
#
- def public_instance_method: (Symbol arg0) -> UnboundMethod
+ def public_instance_method: (id arg0) -> UnboundMethod
# <!--
# rdoc-file=object.c
# - mod.public_instance_methods(include_super=true) -> array
# -->
@@ -1451,11 +1451,11 @@
# C.public_method_defined? "method1", true #=> true
# C.public_method_defined? "method1", false #=> true
# C.public_method_defined? "method2" #=> false
# C.method_defined? "method2" #=> true
#
- def public_method_defined?: (Symbol | String name, ?boolish inherit) -> bool
+ def public_method_defined?: (id name, ?boolish inherit) -> bool
# <!--
# rdoc-file=eval.c
# - refine(mod) { block } -> module
# -->
@@ -1503,31 +1503,31 @@
# *produces:*
#
# 99
# nil
#
- def remove_class_variable: (Symbol arg0) -> untyped
+ def remove_class_variable: (id arg0) -> untyped
# <!--
# rdoc-file=object.c
# - remove_const(sym) -> obj
# -->
# Removes the definition of the given constant, returning that constant's
# previous value. If that constant referred to a module, this will not change
# that module's name and can lead to confusion.
#
- def remove_const: (Symbol arg0) -> untyped
+ def remove_const: (id arg0) -> untyped
# <!--
# rdoc-file=vm_method.c
# - remove_method(symbol) -> self
# - remove_method(string) -> self
# -->
# Removes the method identified by *symbol* from the current class. For an
# example, see Module#undef_method. String arguments are converted to symbols.
#
- def remove_method: (*Symbol | String arg0) -> self
+ def remove_method: (*id arg0) -> self
# <!--
# rdoc-file=object.c
# - mod.singleton_class? -> true or false
# -->
@@ -1589,11 +1589,11 @@
#
# In child
# In parent
# prog.rb:23: undefined method `hello' for #<Child:0x401b3bb4> (NoMethodError)
#
- def undef_method: (*Symbol | String arg0) -> self
+ def undef_method: (*id arg0) -> self
# <!--
# rdoc-file=object.c
# - mod.undefined_instance_methods -> array
# -->
@@ -1627,7 +1627,9 @@
# The first form is equivalent to #attr_reader. The second form is equivalent to
# `attr_accessor(name)` but deprecated. The last form is equivalent to
# `attr_reader(name)` but deprecated. Returns an array of defined method names
# as symbols.
#
- def attr: (*Object::name arg0) -> Array[Symbol]
+ def attr: (*id arg0) -> Array[Symbol]
+
+ type id = Symbol | string
end