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

Save calendar name reference in loaded calendar #82

Merged
merged 4 commits into from
Mar 4, 2021

Conversation

mattmcf
Copy link
Contributor

@mattmcf mattmcf commented Mar 3, 2021

We use Business::Calendar at Modern Treasury.

There are a few use cases where we point a bank interface on a calendar based on several config values. It's helpful for us to sometimes print out the loaded configuration, including the calendar reference. I thought it would be helpful to have a .name reference on the calendar instance.

Copy link
Contributor

@JoeSouthan JoeSouthan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thanks for submitting a PR.

This sounds like a good idea, I've left a couple of suggestions!

working_days: data["working_days"],
extra_working_dates: data["extra_working_dates"],
calendar_name,
**data.slice("holidays", "working_days", "extra_working_days"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should convert initialize to take kwargs here and keep the explicit definition of the arguments.

Suggested change
**data.slice("holidays", "working_days", "extra_working_days"),
name: calendar_name,


def initialize(config)
def initialize(name, config)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, let's convert this to have explicit nil kwargs, something along the lines of:

Suggested change
def initialize(name, config)
def initialize(name:, extra_working_dates: nil, working_days: nil, holidays: nil)

@mattmcf
Copy link
Contributor Author

mattmcf commented Mar 4, 2021

@JoeSouthan Thanks for the suggestion! That is better. I've updated the PR to reflect those nil kwargs.

Copy link
Contributor

@JoeSouthan JoeSouthan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for this!

@JoeSouthan JoeSouthan merged commit 6daebf7 into gocardless:master Mar 4, 2021
@JoeSouthan
Copy link
Contributor

Released as v2.2.0

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