Ahh yea, me being derpy =(. What I wanted to actually do was sanity
check some other methods that would return a new_str:

irb(main):005:0> MyString.new("hello")[0].class
=> MyString
irb(main):006:0> MyString.new("hello").byteslice(1).class
=> MyString
irb(main):007:0> MyString.new("hello").capitalize.class
=> MyString
irb(main):008:0> MyString.new("hello").center(1).class
=> MyString
irb(main):009:0> MyString.new("hello").chomp.class
=> MyString
irb(main):010:0> MyString.new("hello").chop.class
=> MyString
irb(main):011:0> MyString.new("hello").delete("ll").class
=> MyString
irb(main):012:0> MyString.new("hello").downcase.class
=> MyString
irb(main):013:0> MyString.new("hello").dump.class
=> MyString
irb(main):014:0> MyString.new("hello").gsub("ll", "LL").class
=> MyString

On Tue, Feb 10, 2015 at 6:01 PM,  <sawadatsuyoshi / gmail.com> wrote:
> Issue #10845 has been updated by Tsuyoshi Sawada.
>
>
>>Ricky
>
> Methods that modify the receiver and return the receiver would have to return the exact same object, which means that the class is the same.
>
> ----------------------------------------
> Bug #10845: Subclassing String
> https://bugs.ruby-lang.org/issues/10845#change-51468
>
> * Author: Tsuyoshi Sawada
> * Status: Open
> * Priority: Normal
> * Assignee:
> * 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/



-- 
Incoherently,
Ricky Ng