Skip to content

Birds 269 new substitution parameter string to float#71

Merged
walterbloom11 merged 8 commits intomasterfrom
BIRDS-269_new_substitution_parameter_string_to_float
Jan 23, 2026
Merged

Birds 269 new substitution parameter string to float#71
walterbloom11 merged 8 commits intomasterfrom
BIRDS-269_new_substitution_parameter_string_to_float

Conversation

@walterbloom11
Copy link
Contributor

Jira

Description

  • Add a new formatter to convert a string to a float

@walterbloom11 walterbloom11 marked this pull request as ready for review January 23, 2026 17:49
Copilot AI review requested due to automatic review settings January 23, 2026 17:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new formatter to convert strings to floating-point numbers with 2 decimal places precision.

Changes:

  • Added a new to_f formatter class that converts strings to floats
  • Comprehensive test coverage for the new formatter including edge cases
  • Updated version to 3.1.0.wb.1 and documented the change in CHANGELOG

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
lib/parameter_substitution/formatters/to_f.rb Implements the new ToF formatter class with string-to-float conversion logic
spec/lib/parameter_substitution/formatters/to_f_spec.rb Provides comprehensive test coverage for the ToF formatter including valid inputs, nil/empty strings, and invalid inputs
lib/parameter_substitution/version.rb Updates the version number to reflect the new feature
CHANGELOG.md Documents the addition of the new formatter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

CHANGELOG.md Outdated

## [3.1.0.wb.1] - Not Released
### Added
- Added `string_to_float` formatter, which converts a string to a float value.
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

The formatter key is 'to_f' but the changelog refers to it as 'string_to_float'. These should be consistent - either update the changelog to reference 'to_f' or update the key in the code to match 'string_to_float'.

Suggested change
- Added `string_to_float` formatter, which converts a string to a float value.
- Added `to_f` formatter, which converts a string to a float value.

Copilot uses AI. Check for mistakes.
expect(@format_class.format("")).to eq(nil)
expect(@format_class.format(" ")).to eq(nil)
end

Choose a reason for hiding this comment

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

What do you think about treating non-numeric inputs as nil vs 0.0? My thinking is it could make it potentially easier to debug and work-around (using the if_nil functionality). If we use 0.0 it could be ambiguous if the value is actually zero or if we encountered an unexpected/misconfigured value

Choose a reason for hiding this comment

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

We'll want to update this to the final release version prior to merging

Copy link

@hansondr hansondr left a comment

Choose a reason for hiding this comment

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

LGTM, just awaiting final version + changelog update but marking this as approved to not hold up merging 👍

@walterbloom11 walterbloom11 merged commit 0233587 into master Jan 23, 2026
38 of 40 checks passed
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