From: yasuo.honda@... Date: 2020-11-22T16:31:46+00:00 Subject: [ruby-core:101017] [Ruby master Bug#10845] Subclassing String Issue #10845 has been updated by yahonda (Yasuo Honda). Rails Active Support CI against Ruby master branch failed. Performed `git bisect` and found it has been triggered since https://github.com/ruby/ruby/commit/58325daae3beefda13ed100782cd19a89cc68771 . https://buildkite.com/rails/rails/builds/72947#6a6a6523-71a1-4e64-9de2-597a161f0aaa/994-1003 ---------------------------------------- Bug #10845: Subclassing String https://bugs.ruby-lang.org/issues/10845#change-88690 * Author: sawa (Tsuyoshi Sawada) * Status: Closed * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * ruby -v: 2.2 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- If I make a subclass of `String`, the method `*` returns an instance of that class. ~~~ruby class MyString < String end MyString.new("foo").*(2).class #=> MyString ~~~ This is different from other similar operations like `+` and `%`, which return a `String` instance. ~~~ruby MyString.new("foo").+("bar").class #=> String MyString.new("%{foo}").%(foo: "bar").class #=> String ~~~ I don't see clear reason why `*` is to be different from `+` and `%`, and thought that perhaps either the behaviour with `*` is a bug, or the behaviour with `+` and `%` is a bug. Or, is a reason why they are different? -- https://bugs.ruby-lang.org/ Unsubscribe: