summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--range.c5
-rw-r--r--test/ruby/test_range.rb3
2 files changed, 7 insertions, 1 deletions
diff --git a/range.c b/range.c
index 1903b0c1f8..65e863c0fb 100644
--- a/range.c
+++ b/range.c
@@ -1266,7 +1266,10 @@ range_minmax(VALUE range)
if (rb_block_given_p()) {
return rb_call_super(0, NULL);
}
- return rb_assoc_new(range_min(0, NULL, range), range_max(0, NULL, range));
+ return rb_assoc_new(
+ rb_funcall(range, rb_intern("min"), 0),
+ rb_funcall(range, rb_intern("max"), 0)
+ );
}
int
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb
index b37dbbc433..3953b3ecc2 100644
--- a/test/ruby/test_range.rb
+++ b/test/ruby/test_range.rb
@@ -146,6 +146,9 @@ class TestRange < Test::Unit::TestCase
assert_equal([nil, nil], (0...0).minmax)
assert_equal([2, 1], (1..2).minmax{|a, b| b <=> a})
+
+ assert_equal(['a', 'c'], ('a'..'c').minmax)
+ assert_equal(['a', 'b'], ('a'...'c').minmax)
end
def test_initialize_twice