Marshal.dump not dumping entire object?


	I first want to say that this problem is happening with the Runt

gem. This may is likely an implementation issue between Marshal and
Runt. While I’ve simultaneously filed this problem with Matt Lipper,
I’m also hoping someone here can can guide me a little - either in
implementation (usage of Marshal), or to aid me to fix Runt to
support Marshal.

Loading development environment.

start_time = Runt::PDate.min(Runt::REDay::ANY_DATE.year,
Runt::REDay::ANY_DATE.month,, 8, 11)
=> #<Runt::PDate: 3531621371/1440,0,2299161>

data = Marshal.dump(start_time)
=> “\004\010u:\020Runt::PDateA\004\010[\010o:\rRational\a:
\[email protected]+\a\373C\200\322:\[email protected]\002\240\005i\000i

obj = Marshal.load(data)
=> #<Runt::PDate: 3531621371/1440,0,2299161>

=> #<Runt::DPrecision::Precision:0x2753cfc @precision=4>

=> 4

=> nil

as you can see - after round tripping through Marshal, date_precision
isn’t restored (likely not marshalled) to obj.

Is is possible that Runt’s date_precision violates a rule for

I can note from the source the following,
#Pseudo Singletons:
YEAR = Precision.year
MONTH = Precision.month
I seem to remember something about singletons and YAML. Does the same
hold for Marshal?

Perhaps it’s a deep copy issue? specifying Marshal.dump(start_time,
10) (10 is very deep) makes no diff.

Thanx for any thoughts or references that can take me to the next level.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs