-
Notifications
You must be signed in to change notification settings - Fork 465
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
Control how numbers on their own are treated #205
base: master
Are you sure you want to change the base?
Conversation
if options[:ambiguous_number_priority] == :date | ||
@@definitions[:date] << Handler.new([:scalar_day], :handle_sd) | ||
else | ||
@@definitions[:date] = @@definitions[:date].reject { |l| l.pattern == [:scalar_day] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this 214 line does nothing, there's no such pattern with just [:scalar_day]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this same commit adds it if : ambiguous_number_priority is :date. I was finding that these definitions seemed to persist between calls, so if you called it once with : ambiguous_number_priority => :date and then later with : ambiguous_number_priority => :time then it would break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh right, it caches. Actually I think it's not good idea to change @@definitions
, it's not thread safe and better would be just parse that option in some handler or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So maybe have a handle_lonely_int that decides for itself whether to treat it as a day or an hour based upon options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that would work I think.
I've been working to fix lot of things in Chronic, but it's taking more time than I thought it will and I still haven't finished yet. There will be |
I've also fixed issue with |
Hi there,
This pull request includes one bug fix and one 'feature':