Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writer should use code/iso8601 for date/time/datetime, not inspect #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Writer should use code/iso8601 for date/time/datetime, not inspect #63

wants to merge 1 commit into from

Conversation

garysweaver
Copy link

To resolve #43 and #62, this converts Date, Time, DateTime (and ActiveSupport::TimeWithZone if exists) to code that creates a date using the iso8601 version of each time.

This could use some optimization. A much faster way is just to override inspect on Date, Time, DateTime (and ActiveSupport::TimeWithZone if exists) to return "(the class name).iso8601(#{iso8601.inspect})". However, this patch avoids inspect overrides, and it is doubtful most would want inspect overriden. It is ~3x slower than before. (4043 records took 8.1 sec vs. 2.4 sec and 79808 records took 83 sec vs. 30 sec).

Another option might be to use inspect but only temporarily override inspect on the affected classes (Date, Time, etc.), but I'm not absolutely sure that would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Writer uses inspect to serialize object
1 participant