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

Overloaded get methods to return fallback Option #125

Closed
wants to merge 1 commit into from

Conversation

bdbenim
Copy link

@bdbenim bdbenim commented Oct 9, 2023

This PR adds overloaded get methods to both Section and Document classes with an additional parameter of type bool called returnOption. If set to True (defaults to False) then any fallback value returned will be a new object of type Option rather than simply the value of the fallback parameter. This option will have the value of the option parameter as its key and the fallback or default parameter as its value.

Of note, this new option will not be attached to any section, which may not be the desired result. I made that choice because I don't believe that the actual config file should be updated to include any default/fallback options if the user decides to save the file later. Rather, these should be explicitly added.

Similarly, a new overloaded get_section method has been added to the Document class which has the same behaviour as described above but for Section objects. Again, these will be created as orphan sections and not attached to the document.

@bdbenim
Copy link
Author

bdbenim commented Oct 9, 2023

I'm not sure why that one test failed. I just tried running it on my machine to make sure and it outputs a length of 14 as the test expects.

@bdbenim bdbenim closed this Oct 24, 2023
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.

1 participant