Project

General

Profile

Bug #11233

Module#include, Module#prepend can accept no arguments

Added by Anonymous almost 4 years ago. Updated almost 4 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
[ruby-core:69488]

Description

# Module#include, Module#prepend can accept no arguments
Module.new.include
Module.new.prepend

History

Updated by jeremyevans0 (Jeremy Evans) almost 4 years ago

This isn't a bug, it a consequence of the fact that they take an arbitrary number of arguments:

Module.new.include(Module.new, Module.new, ...)

Changing it would break code like:

extensions = []
extensions << Module.new if something
extensions << Module.new if something_else
Module.new.include(*extensions)

Updated by Anonymous almost 4 years ago

Jeremy Evans, you are right.

Also available in: Atom PDF