Skip to content

Conversation

@olbrich
Copy link
Owner

@olbrich olbrich commented Dec 27, 2025

This pull request introduces several documentation improvements and code enhancements to the RubyUnits library, focusing on clarifying usage, extending features, and improving configuration flexibility. The most significant changes are detailed updates to the README.md to provide clearer examples, expanded explanations of time and math operations, and new configuration options. Additionally, the codebase now supports more robust and explicit handling of date arithmetic and configuration management.

Documentation improvements:

  • Expanded the README.md to provide detailed examples of string formatting with units, direct string-to-unit conversions, and comprehensive explanations of time helpers, including adding/subtracting durations, converting between Time/Date and units, and handling large time units with calendar accuracy. Added sections on math functions, new unit definitions, and configuration options. [1] [2] [3] [4] [5] [6]
  • Removed outdated badges and streamlined the project introduction in README.md.

Configuration enhancements:

  • Added a default_precision option to the RubyUnits::Configuration class, allowing users to control the precision used when rationalizing fractional values in unit output. Updated documentation and code to support and explain new and legacy configuration options, including improved validation and deprecation warnings for boolean separator values. [1] [2] [3]

Date arithmetic improvements:

  • Refactored the RubyUnits::Date module to provide more explicit and accurate handling of adding and subtracting durations to/from Date objects, especially for large time units (years, decades, centuries). The new implementation ensures durations are converted to days and rounded as needed for calendar accuracy, with improved documentation and private helper methods.

Development tooling:

  • Added the ruby-lsp gem as an optional development dependency in the Gemfile to improve language server support.

@olbrich olbrich self-assigned this Dec 27, 2025
@olbrich olbrich marked this pull request as ready for review December 27, 2025 17:03
@olbrich olbrich added the Minor add functionality in a backwards-compatible manner label Dec 27, 2025
@olbrich olbrich changed the title Refactor unit methods for improved inheritance support Code quality and documentation improvements Dec 27, 2025
@olbrich olbrich merged commit ff0d70f into master Dec 27, 2025
9 of 10 checks passed
@olbrich olbrich deleted the reek-cleanup branch December 27, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Minor add functionality in a backwards-compatible manner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants