mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Small improvements to Module#{include,prepend}
Array objects obtained as splat arguments are generated within the method. Therefore, it is safe to perform destructive operations.
This commit is contained in:
+4
-2
@@ -22,7 +22,8 @@ class Module
|
||||
|
||||
# 15.2.2.4.27
|
||||
def include(*args)
|
||||
args.reverse.each do |m|
|
||||
args.reverse!
|
||||
args.each do |m|
|
||||
m.append_features(self)
|
||||
m.included(self)
|
||||
end
|
||||
@@ -30,7 +31,8 @@ class Module
|
||||
end
|
||||
|
||||
def prepend(*args)
|
||||
args.reverse.each do |m|
|
||||
args.reverse!
|
||||
args.each do |m|
|
||||
m.prepend_features(self)
|
||||
m.prepended(self)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user