Move `Array#difference` just after `Array#-`.
MODIFY
mrbgems/mruby-array-ext/mrblib/array.rb
mrbgems/mruby-array-ext/mrblib/array.rb
@@ -88,6 +88,22 @@ class Array
array
end
+ ##
+ # call-seq:
+ # ary.difference(other_ary1, other_ary2, ...) -> new_ary
+ #
+ # Returns a new array that is a copy of the original array, removing all
+ # occurrences of any item that also appear in +other_ary+. The order is
+ # preserved from the original array.
+ #
+ def difference(*args)
+ ary = self
+ args.each do |x|
+ ary = ary - x
+ end
+ ary
+ end
+
##
# call-seq:
# ary | other_ary -> new_ary
@@ -124,22 +140,6 @@ class Array
ary
end
- ##
- # call-seq:
- # ary.difference(other_ary1, other_ary2, ...) -> new_ary
- #
- # Returns a new array that is a copy of the original array, removing all
- # occurrences of any item that also appear in +other_ary+. The order is
- # preserved from the original array.
- #
- def difference(*args)
- ary = self
- args.each do |x|
- ary = ary - x
- end
- ary
- end
-
##
# call-seq:
# ary & other_ary -> new_ary

Move `Array#difference` just after `Array#-`.