[macruby-changes] [MacRuby/MacRuby] 37df0d: String#partition will return subclass instance.
noreply at github.com
noreply at github.com
Fri Apr 22 03:04:27 PDT 2011
Branch: refs/heads/master
Home: https://github.com/MacRuby/MacRuby
Commit: 37df0df9d7e5c62848624a0643f17346a2c0eee7
https://github.com/MacRuby/MacRuby/commit/37df0df9d7e5c62848624a0643f17346a2c0eee7
Author: Watson <watson1978 at gmail.com>
Date: 2011-04-22 (Fri, 22 Apr 2011)
Changed paths:
M string.c
Log Message:
-----------
String#partition will return subclass instance.
Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions
class SubStr < String
def value
"value : " + self
end
end
str = SubStr.new("hello\n world")
str.partition("x").each do |x|
assert_equal(SubStr, x.class)
puts x.value
end
ary = str.partition("l")
assert_equal(SubStr, ary[0].class)
assert_equal(String, ary[1].class)
assert_equal(SubStr, ary[2].class)
puts :ok
}}}
Commit: 246dd5d21d6281e7db61d2660239f359459e0a65
https://github.com/MacRuby/MacRuby/commit/246dd5d21d6281e7db61d2660239f359459e0a65
Author: Watson <watson1978 at gmail.com>
Date: 2011-04-22 (Fri, 22 Apr 2011)
Changed paths:
M string.c
Log Message:
-----------
String#rpartition will return subclass instance.
Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions
class SubStr < String
def value
"value : " + self
end
end
str = SubStr.new("hello\n world")
str.rpartition("x").each do |x|
assert_equal(SubStr, x.class)
puts x.value
end
ary = str.rpartition("l")
assert_equal(SubStr, ary[0].class)
assert_equal(String, ary[1].class)
assert_equal(SubStr, ary[2].class)
puts :ok
}}}
Compare: https://github.com/MacRuby/MacRuby/compare/be34f68...246dd5d
More information about the macruby-changes
mailing list