Currently
Marshal.load(Marshal.dump(object))
is used to get a deep clone of an Arel AST which is necessary when modifying the tree. Using Marshal feel like a hack to get a deep clone, Ruby's initialize_copy feels like a better solution to this problem.
To achieve this all Arel nodes need to implement initialize_copy when their instance variables contain a complex object, a non scalar like String or Integer.
Currently
is used to get a deep clone of an Arel AST which is necessary when modifying the tree. Using
Marshalfeel like a hack to get a deep clone, Ruby'sinitialize_copyfeels like a better solution to this problem.To achieve this all Arel nodes need to implement
initialize_copywhen their instance variables contain a complex object, a non scalar like String or Integer.