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

Don't call upcase! and preserve original values #4

Merged
merged 1 commit into from
Feb 1, 2018

Conversation

FanaHOVA
Copy link
Contributor

The upcase! call is modifying the params passed to the method call, which can be a pain to debug since it's not a clear result. Example:

> test = 'Alessio'
> CodiceFiscale.calculate(name: test,.... )
// Calculated Value
> test == 'ALESSIO'
true

If this is used in an ActiveRecord validation, the upcase value will be passed along and it will be stored in the database as upcase instead of having its original capitalization. Right now I'm using

CodiceFiscale.calculate(name: name.dup...)

But it seems like an unnecessary thing to do, a library should never change the values I pass to it unless it's a bang method.

@topac topac merged commit 5235a68 into topac:master Feb 1, 2018
topac added a commit that referenced this pull request Nov 2, 2019
Don't call upcase! and preserve original values
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.

None yet

2 participants