File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,13 +29,23 @@ class RDoc::Alias < RDoc::CodeObject
2929 # Creates a new Alias that aliases +old_name+
3030 # to +new_name+, has +comment+ and is a +singleton+ context.
3131
32- def initialize ( old_name , new_name , comment , singleton : false )
32+ def initialize ( * args , singleton : false )
3333 super ( )
3434
35+ if args . size == 4
36+ warn ( <<~MSG , uplevel : 1 , category : :deprecated )
37+ Support for passing 4 arguments to RDoc::Alias.new is deprecated and will be removed. \
38+ Simply drop the first argument.
39+ MSG
40+ args . shift
41+ elsif args . size != 3
42+ raise ArgumentError , "wrong number of arguments (given #{ args . size } , expected 3)"
43+ end
44+
3545 @singleton = singleton
36- @old_name = old_name
37- @new_name = new_name
38- self . comment = comment
46+ @old_name = args [ 0 ]
47+ @new_name = args [ 1 ]
48+ self . comment = args [ 2 ]
3949 end
4050
4151 ##
Original file line number Diff line number Diff line change @@ -41,8 +41,18 @@ class RDoc::AnyMethod < RDoc::MethodAttr
4141 ##
4242 # Creates a new AnyMethod with name +name+
4343
44- def initialize ( name , singleton : false )
45- super ( name , singleton : singleton )
44+ def initialize ( *args , singleton : false )
45+ if args . size == 2
46+ warn ( <<~MSG , uplevel : 1 , category : :deprecated )
47+ Support for passing 2 arguments to RDoc::AnyMethod.new is deprecated and will be removed. \
48+ Simply drop the first argument.
49+ MSG
50+ args . shift
51+ elsif args . size != 1
52+ raise ArgumentError , "wrong number of arguments (given #{ args . size } , expected 1)"
53+ end
54+
55+ super ( name = args [ 0 ] , singleton : singleton )
4656
4757 @c_function = nil
4858 @dont_rename_initialize = false
Original file line number Diff line number Diff line change @@ -24,11 +24,21 @@ class RDoc::Attr < RDoc::MethodAttr
2424 # Creates a new Attr with +name+, read/write status +rw+ and
2525 # +comment+. +singleton+ marks this as a class attribute.
2626
27- def initialize ( name , rw , comment , singleton : false )
28- super ( name , singleton : singleton )
27+ def initialize ( *args , singleton : false )
28+ if args . size == 4
29+ warn ( <<~MSG , uplevel : 1 , category : :deprecated )
30+ Support for passing 4 arguments to RDoc::Attr.new is deprecated and will be removed. \
31+ Simply drop the first argument.
32+ MSG
33+ args . shift
34+ elsif args . size != 3
35+ raise ArgumentError , "wrong number of arguments (given #{ args . size } , expected 3)"
36+ end
37+
38+ super ( args [ 0 ] , singleton : singleton )
2939
30- @rw = rw
31- self . comment = comment
40+ @rw = args [ 1 ]
41+ self . comment = args [ 2 ]
3242 end
3343
3444 ##
You can’t perform that action at this time.
0 commit comments