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

Convert arguments of Tod::Shift #68

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

IvanSelivanov
Copy link

Tod::Shift assumes that its arguments have type Tod::TimeOfDay but it does not really check it. So I guess it's a good idea to either raise an error if arguments have different type, or to try to convert them to correct type.

I chose to convert arguments so one could pass a String or Time to Tod::Shift

@jackc
Copy link
Owner

jackc commented Aug 17, 2019

This is a reasonable change, but it could be done without the ternary test to see if it is already a TimeOfDay. The TimeOfDay function already does that: see https://github.com/jackc/tod/blob/master/lib/tod/conversions.rb#L3

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.

2 participants