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

Refactor handle_command / no more switch statement #26

Merged
merged 1 commit into from
Dec 28, 2023

Commits on Dec 27, 2023

  1. Refactor handle_command / no more switch statement

    Given that each command has a corresponding handle_ method, we don't
    really need a switch statement. We can just call the methods dynamically
    and rescue the NoMethodError. This makes it easier to handle new commands
    in the future by simply adding a new handle_ method.
    
    I've also refactored how we break the main loop in the test scenario.
    Instead of returning true/false, a command can explicitly return :break.
    
    Co-authored-by: Nate Vick <nate.vick@hint.io>
    benjaminwood and natevick committed Dec 27, 2023
    Configuration menu
    Copy the full SHA
    68f3050 View commit details
    Browse the repository at this point in the history