Rubyって何でもできるんですね。
class A
attr_reader :x
def initialize(x)
@x = x
end
end
class B
def self.new(x)
obj = A.allocate
obj.send(:initialize, x)
obj
end
end
b = B.new('abc')
puts b.class # => A
puts b.x # => abc
もちろん多用すると収拾がつかなくなるだけですが、
newの引数によって別のサブクラスを生成したい場合などは、
自然な呼び出し方ができますね。
継承した時などに思わぬ挙動をすることがあるようなので、
いろいろ試行錯誤中。
それも考慮した書き方もできそうです。