[macruby-changes] [MacRuby/MacRuby] 611381: String#each_char will yield subclass instance.

noreply at github.com noreply at github.com
Thu Apr 21 21:32:15 PDT 2011


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

Commit: 61138147d28caceec6c797dce85a5bba3ba30437
    https://github.com/MacRuby/MacRuby/commit/61138147d28caceec6c797dce85a5bba3ba30437
Author: Watson <watson1978 at gmail.com>
Date:   2011-04-21 (Thu, 21 Apr 2011)

Changed paths:
  M string.c

Log Message:
-----------
String#each_char will yield 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("abcd")
str.each_char {|c|
  assert_equal(SubStr, c.class)
  puts c.value
}

puts :ok
}}}


Commit: be34f68aca462aaf010f74f5d626e098dbafae3d
    https://github.com/MacRuby/MacRuby/commit/be34f68aca462aaf010f74f5d626e098dbafae3d
Author: Watson <watson1978 at gmail.com>
Date:   2011-04-21 (Thu, 21 Apr 2011)

Changed paths:
  M string.c

Log Message:
-----------
String#succ 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("abcd")
assert_equal(SubStr, str.succ.class)

puts :ok
}}}


Compare: https://github.com/MacRuby/MacRuby/compare/636eed7...be34f68


More information about the macruby-changes mailing list