Merged
Conversation
… README and tests. Convert with strings, and better handle errors (1.6.0)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and updates to the
calcpacegem, focusing on enhanced input validation, expanded and more flexible unit conversion functionality, improved documentation, and updated dependencies. The most significant changes are grouped below.Unit Conversion Enhancements:
convertandconstantmethods inlib/calcpace/converter.rbnow accept both symbol and string unit formats (e.g.,:km_to_mior'km to mi'). A newformat_unitmethod normalizes string inputs, and the converter now supports 42 units. Thelist_all,list_speed, andlist_distancemethods now return hashes mapping unit keys to human-readable descriptions instead of arrays. [1] [2]test/calcpace/test_converter.rbhas been updated to test string-based unit conversions, verify the new hash output of list methods, and check the content of the returned hashes.Input Validation Improvements:
lib/calcpace/calculator.rbnow pass argument names tovalidate_positive, which in turn callscheck_positivewith descriptive names. This results in more informative error messages, e.g., "Distance must be a positive number". [1] [2] [3] [4] [5]check_positivemethod inlib/calcpace/checker.rbnow accepts an argument name and uses it in error messages.Documentation Updates:
README.mdhas been updated to reflect the new version (1.6.0), expanded unit support, new input formats for conversion, updated examples, and clarified return values for listing methods. Error message documentation has also been updated for accuracy. [1] [2] [3] [4] [5]Version and Dependency Updates:
3.4.4in.ruby-versionand.tool-versions, and Node.js24.1.0is added to.tool-versions. [1] [2]1.6.0in bothlib/calcpace/version.rbandREADME.md. The gemspec is updated to freeze string literals. [1] [2]These changes collectively improve the usability, flexibility, and clarity of the
calcpacegem for both developers and end users.