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 FormResponse#to_hash to support implicit hash conversion #11476

Merged
merged 4 commits into from
Nov 7, 2024

Conversation

aduth
Copy link
Member

@aduth aduth commented Nov 7, 2024

🛠 Summary of changes

Adds FormResponse#to_hash as an alias of FormResponse#to_h to support implicit hash conversion.

Before:

analytics.something_submitted(**result.to_h)

After:

analytics.something_submitted(**result)

Existing instances updated with find and replace pattern:

  • Search: \*\*(\w*)(result|response).to_h([),])
  • Replace: **$1$2$3

Related Slack discussion: https://gsa-tts.slack.com/archives/C0NGESUN5/p1730987694583649

Related information about implicit and explicit type conversions in Ruby: https://zverok.space/blog/2016-01-18-implicit-vs-expicit.html

📜 Testing Plan

Verify build passes.

@aduth aduth requested a review from zachmargolis November 7, 2024 18:51
aduth added 4 commits November 7, 2024 14:28
changelog: Internal, Form Validation, Alias FormResponse#to_hash to #to_h
Search: \*\*(\w*)(result|response).to_h([),])
Replace: **$1$2$3
@aduth aduth force-pushed the aduth-form-response-to-hash branch from f7187a4 to 1516638 Compare November 7, 2024 19:31
@aduth aduth merged commit b2336d3 into main Nov 7, 2024
2 checks passed
@aduth aduth deleted the aduth-form-response-to-hash branch November 7, 2024 20:09
@aduth aduth mentioned this pull request Nov 12, 2024
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