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

Exception with default_starts_date #35

Open
danielveloso09 opened this issue Aug 18, 2021 · 0 comments
Open

Exception with default_starts_date #35

danielveloso09 opened this issue Aug 18, 2021 · 0 comments

Comments

@danielveloso09
Copy link

danielveloso09 commented Aug 18, 2021

Hi,

Thanks for the work on this gem, it has been quite useful in different projects through the years 😅

While doing some tests found a small issue doing Recurrence.default_starts_date, which raises an exception. But if you do Recurrence_.default_starts_date everything works fine. We can also just force the starts option, and everything is fine.

Notice that you've changed default_stars_date class method a couple months ago, which raised this issue when using Recurrence or any class that extends from Recurrence_

Is there any specific reason to have the method like:

def self.default_starts_date
  @default_starts_date.call
end

Instead of directly use the constant:

def self.default_starts_date
  DEFAULT_STARTS_DATE.call
end

If you don't see any issue with the above suggestion, I would be glad to open the PR to fix it.


Edit:

While running the test got the intention for it 👍

So could it be something like this?

def self.default_starts_date
  @default_starts_date ||= DEFAULT_STARTS_DATE
  @default_starts_date.call
end

Also, this didn't appear on the tests cause in the test_helper.rb#setup is setting it

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

No branches or pull requests

1 participant