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

Simplify entrypoint #317

Merged
merged 1 commit into from
Jul 17, 2023
Merged

Simplify entrypoint #317

merged 1 commit into from
Jul 17, 2023

Conversation

fxn
Copy link
Contributor

@fxn fxn commented Jul 16, 2023

Hey! :)

The autoload calls in this file are unnecessary, because the require calls above already define those constants.

Since I was on it, I refactored the way I normally write a file like this. Let me explain:

  • Since this file is simple_calendar.rb, I find ordered that it owns the creation of the SimpleCalendar module. Then, descendants reopen. They can also use constant paths like SimpleCalendar::ViewHelpers in the definition of child classes and modules if they so wish, because they can rely on the parent module being already defined upwards. (This is only a consequence, not the motivation.)
  • For the same price, we can avoid $LOAD_PATH lookups by using require_relative.

However, these points are kind of personal style, if you prefer something else please just tell me :).

@excid3 excid3 merged commit 72889cd into excid3:master Jul 17, 2023
@excid3
Copy link
Owner

excid3 commented Jul 17, 2023

Thanks @fxn! This all makes sense to me. Appreciate 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

Successfully merging this pull request may close these issues.

2 participants