Which Ruby classes support .clone?

前端 未结 6 929
自闭症患者
自闭症患者 2021-01-05 02:48

Ruby defines #clone in Object. To my suprise, some classes raise Exceptions when calling it. I found NilClass, TrueCla

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-05 03:12

    Rails appears to extend the classes you mention with a "duplicable?()" method.

    http://api.rubyonrails.org/files/activesupport/lib/active_support/core_ext/object/duplicable_rb.html

提交回复
热议问题