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

Add robustness to ActiveSnapshot::Config #54

Closed

Conversation

dmrAnderson
Copy link
Contributor

Added: Improved ActiveSnapshot::Config for better clarity, maintainability, and robustness

Changes include:

  • Introduced constants for storage methods
  • Added a custom error class for invalid storage method errors
  • Refactored predicate methods to reduce code duplication
  • Enhanced error messages for invalid storage methods

…ility, and robustness

Changes include:
 - Introduced constants for storage methods
 - Added a custom error class for invalid storage method errors
 - Refactored predicate methods to reduce code duplication
 - Enhanced error messages for invalid storage methods
@westonganger
Copy link
Owner

I've reviewed this. The only piece of this PR that I am in favor of is: the use of constants for the storage methods.

module ActiveSnapshot
class Config
class InvalidStorageMethodError < StandardError
Copy link
Owner

Choose a reason for hiding this comment

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

This error occurs at boot time rather than runtime. So I do not think that we need a specific error class for this.


SERIALIZED_YAML = 'serialized_yaml'
SERIALIZED_JSON = 'serialized_json'
NATIVE_JSON = 'native_json'
Copy link
Owner

Choose a reason for hiding this comment

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

These constants would need to be frozen too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

private

def storage_method?(method)
storage_method == method
end
Copy link
Owner

Choose a reason for hiding this comment

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

I dont think this was needed. It was very simple in the first place, I would say this is overuse of private methods.

@westonganger
Copy link
Owner

Im closing this PR as I am rejecting most of the suggested changes. Please open a new PR if you want to add the constants for the storage methods.

@dmrAnderson
Copy link
Contributor Author

Thx for feedback

@dmrAnderson dmrAnderson deleted the add-robustness-to-config branch November 8, 2024 21:14
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