I have trouble in duplicationg class inheriting Array. Here is a sample code.
class Foo; end class Bar < Array(Foo) end bar = Bar.new bar2 = bar.dup puts typeof(bar2) # => Array(Foo)
bar2’s type becomes Array(Foo). I know it’s natural because
bar.dup calls Array#dup.
But, I want bar2’s type to be Bar.
Are there any solution to duplicate and keep it’s type