Fix for TranslatedString to close #136 #147
Merged
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.
The subject says it all, this is the fix for issues discussed in #136.
The solution drops the
@value
idea and uses self as the authoritative value again instead, but the trick was to usesuper
instead ofself
in#to_s
to make it all work correctly withString.new
, ActiveRecord'sStringBuffer
, etc.Tested against 2.1.10, 2.2.3, 2.3.4 and 2.4.1.
BTW, note that I kept the changes at the minimum, so
Untranslated#to_s
still returnsTranslatedString
, notString
, as it always did before. I am not sure if this was intentional or not. If you want to change this, simply adding.to_s
on the@filter.process
result inUntranslated#to_s
would do the trick.