Sometimes I need such method, which could change class of its own object. There are String#delete!
, #downcase!
, #encode!
, #gsub!
, #strip!
, #slice!
, etc. They are all trying to change string, but resulting class is anyway still String
. And I want a method, which can convert String
to Array
.
Some way to make this:
irb(main):082:0> str = "qwerty"
=> "qwerty"
irb(main):083:0> str.split! "e"
=> ["qw", "rty"]
irb(main):084:0> str
=> ["qw", "rty"]
Is it possible? Maybe some cool japan kung-fu or ugly bicycles — I would like to see any solution.