summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xminirake4
-rw-r--r--mrbgems/mruby-array-ext/mrblib/array.rb2
-rw-r--r--mrbgems/mruby-array-ext/test/array.rb10
-rw-r--r--mrblib/array.rb3
4 files changed, 16 insertions, 3 deletions
diff --git a/minirake b/minirake
index e48ca1306..824e9b598 100755
--- a/minirake
+++ b/minirake
@@ -325,6 +325,8 @@ class RakeApp
"Display usage."],
['--verbose', '-v', GetoptLong::NO_ARGUMENT,
"Log message to standard output (default)."],
+ ['--directory', '-C', GetoptLong::REQUIRED_ARGUMENT,
+ "Change executing directory of rakefiles."]
]
# Create a RakeApp object.
@@ -415,6 +417,8 @@ class RakeApp
when '--version'
puts "rake, version #{RAKEVERSION}"
exit
+ when '--directory'
+ Dir.chdir value
else
fail "Unknown option: #{opt}"
end
diff --git a/mrbgems/mruby-array-ext/mrblib/array.rb b/mrbgems/mruby-array-ext/mrblib/array.rb
index 18ed5e303..2e66c5fbc 100644
--- a/mrbgems/mruby-array-ext/mrblib/array.rb
+++ b/mrbgems/mruby-array-ext/mrblib/array.rb
@@ -204,7 +204,7 @@ class Array
# for efficiency
def reverse_each(&block)
- return to_enum :sort_by unless block_given?
+ return to_enum :reverse_each unless block_given?
i = self.size - 1
while i>=0
diff --git a/mrbgems/mruby-array-ext/test/array.rb b/mrbgems/mruby-array-ext/test/array.rb
index 7f296f591..ed1edb5c2 100644
--- a/mrbgems/mruby-array-ext/test/array.rb
+++ b/mrbgems/mruby-array-ext/test/array.rb
@@ -131,3 +131,13 @@ assert("Array#fill") do
assert_equal [1, 2, 3, 27], a.fill(0..1) { |i| i+1 }
assert_raise(ArgumentError) { a.fill }
end
+
+assert("Array#reverse_each") do
+ a = [ "a", "b", "c", "d" ]
+ b = []
+ a.reverse_each do |i|
+ b << i
+ end
+ assert_equal [ "d", "c", "b", "a" ], b
+ assert_equal [ "d", "c", "b", "a" ], a.reverse_each.to_a
+end
diff --git a/mrblib/array.rb b/mrblib/array.rb
index f3c7967cb..a7f172879 100644
--- a/mrblib/array.rb
+++ b/mrblib/array.rb
@@ -112,11 +112,10 @@ class Array
end
##
-# Array is enumerable and comparable
+# Array is enumerable
class Array
# ISO 15.2.12.3
include Enumerable
- include Comparable
##
# Sort all elements and replace +self+ with these