[macruby-changes] [MacRuby/MacRuby] 169020: String#slice will return subclass instance when wa...

noreply at github.com noreply at github.com
Fri Apr 22 20:12:33 PDT 2011


Branch: refs/heads/master
Home:   https://github.com/MacRuby/MacRuby

Commit: 1690201e2ebe2ade45c010c0814a4e06d8d9ff0a
    https://github.com/MacRuby/MacRuby/commit/1690201e2ebe2ade45c010c0814a4e06d8d9ff0a
Author: Watson <watson1978 at gmail.com>
Date:   2011-04-22 (Fri, 22 Apr 2011)

Changed paths:
  R spec/frozen/tags/macruby/core/string/slice_tags.txt
  M string.c

Log Message:
-----------
String#slice will return subclass instance when was passed subclass instance.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

class SubStr < String
  def value
    "value : " + self
  end
end

s = SubStr.new("el")
r = "hello".slice!(s)
assert_equal("el", r)
assert_equal(SubStr, r.class)

puts :ok
}}}




More information about the macruby-changes mailing list