-
Notifications
You must be signed in to change notification settings - Fork 8
TypeError (can't copy BigDecimal) #6
Comments
Ok, in fact there are some classes in Ruby which are no cloneable. We catched most of them but probably missed the BigDecimal class. Should be a fairly easy one to fix. Rodolfo Spalenza [email protected] schrieb:
|
Uhh, not that simple since BigDecimal is part of the stdlib and not core. Will have a look on it 2moro. |
Hi @balmma, why you can't include stdlib? |
Well, it's not that simple in a C extension. Most probably the best way would be to catch the exception and use the original value. But I need to do some work to get this running. |
Problem fixed. I added a check to not clone Numeric and it's descendants at all (just take the same object). Created GEM version 0.5.0. |
Hi @balmma, require "bigdecimal"
require "deep_clone"
big_decimal = BigDecimal.new(1)
new_big_decimal = DeepClone.clone big_decimal And return this:
|
Does it work in the newest version? Btw. which Ruby version are you using? |
ruby 2.0.0p353 its working fine but with 1.9.3p374 I get a same error (both with RVM). |
Hi! I need to make a depth copy of objects with BigDecimal values.
When a try, I get this error. TypeError (can't copy BigDecimal)
Thanks.
The text was updated successfully, but these errors were encountered: