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
18 changes: 14 additions & 4 deletions lib/rdoc/code_object/alias.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,23 @@ class RDoc::Alias < RDoc::CodeObject
# Creates a new Alias that aliases +old_name+
# to +new_name+, has +comment+ and is a +singleton+ context.

def initialize(old_name, new_name, comment, singleton: false)
def initialize(*args, singleton: false)
super()

if args.size == 4
warn(<<~MSG, uplevel: 1, category: :deprecated)
Support for passing 4 arguments to RDoc::Alias.new is deprecated and will be removed. \
Simply drop the first argument.
MSG
args.shift
elsif args.size != 3
raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 3)"
end

@singleton = singleton
@old_name = old_name
@new_name = new_name
self.comment = comment
@old_name = args[0]
@new_name = args[1]
self.comment = args[2]
end

##
Expand Down
14 changes: 12 additions & 2 deletions lib/rdoc/code_object/any_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,18 @@ class RDoc::AnyMethod < RDoc::MethodAttr
##
# Creates a new AnyMethod with name +name+

def initialize(name, singleton: false)
super(name, singleton: singleton)
def initialize(*args, singleton: false)
if args.size == 2
warn(<<~MSG, uplevel: 1, category: :deprecated)
Support for passing 2 arguments to RDoc::AnyMethod.new is deprecated and will be removed. \
Simply drop the first argument.
MSG
args.shift
elsif args.size != 1
raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 1)"
end

super(name = args[0], singleton: singleton)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For clarity this shows what this actually is. The other two assign it to named locals, here there is no such thing


@c_function = nil
@dont_rename_initialize = false
Expand Down
18 changes: 14 additions & 4 deletions lib/rdoc/code_object/attr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,21 @@ class RDoc::Attr < RDoc::MethodAttr
# Creates a new Attr with +name+, read/write status +rw+ and
# +comment+. +singleton+ marks this as a class attribute.

def initialize(name, rw, comment, singleton: false)
super(name, singleton: singleton)
def initialize(*args, singleton: false)
if args.size == 4
warn(<<~MSG, uplevel: 1, category: :deprecated)
Support for passing 4 arguments to RDoc::Attr.new is deprecated and will be removed. \
Simply drop the first argument.
MSG
args.shift
elsif args.size != 3
raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 3)"
end

super(args[0], singleton: singleton)

@rw = rw
self.comment = comment
@rw = args[1]
self.comment = args[2]
end

##
Expand Down
Loading