jeremyevans / home_run

Fast Date/DateTime classes for ruby :: Unmaintained, unnecessary on ruby 1.9.3+
Other
465 stars 10 forks source link

Can't Marshal home_run DateTimes #28

Closed epitron closed 13 years ago

epitron commented 13 years ago

Hi there!

Would it be difficult to implement the marshal_load function for the faster DateTimes?

I use Marshal to quickly serialize the dataset for my delicious-cli gem, and it gives me this:

/home/epi/.rvm/gems/ruby-head/gems/delicious-cli-0.4.1/lib/delicious-cli/db.rb:40:in `load':
    instance of DateTime needs to have method `marshal_load' (TypeError)

Any familiarity with this? Or am I on my own? :)

jeremyevans commented 13 years ago

home_run implements the old style _dump and _load methods, both for compatibility with ruby 1.8 and because DateTime instances are immutable, and the new style marshal_load would require the ability to modify the C level data structure.

You are able to marshal home_run Date and DateTime objects, but home_run uses a different marshalling format than the stdlib. My guess is you are attempting to unmarshal a DateTime object using home_run that was marshalled using the stdlib. That won't work.

So I am familiar with this issue, but you are on your own if you want to fix it. You may want to run ruby-head, which includes a much faster version of the stdlib DateDateTime classes that are more backwards compatible than home_run.

epitron commented 13 years ago

Ahhh, excellent! Thanks for the tips. :D

I am actually using ruby-head, so it's good to know that home_run isn't even necessary. It's still an excellent gem though! :)