-
Notifications
You must be signed in to change notification settings - Fork 552
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
Implement custom Marshal encoder/decoder for StripeObject
#592
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r? @ob-stripe |
ob-stripe
reviewed
Oct 13, 2017
test/stripe/stripe_object_test.rb
Outdated
@@ -410,5 +410,18 @@ class StripeObjectTest < Test::Unit::TestCase | |||
end | |||
assert_match(/\(object\).foo = nil/, e.message) | |||
end | |||
|
|||
should "marshal and unmarshal using custom encoder and decoer" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small typo here ("decoer")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arg, thanks. Fixed and commit amended.
brandur-stripe
force-pushed
the
brandur-reimplement-custom-marshal
branch
from
October 13, 2017 16:24
2fb50a5
to
0a1d418
Compare
lgtm! |
Backtracks a little bit #586 by bringing back custom `StripeObject` encoding and decoding methods for Ruby's `Marshal`. These work by just persisting values and some opts, and skipping everything else. It's mostly the same as what we had before, but implemented a little more cleanly so that we don't actually need to invoke `Marshal` anywhere ourselves. In #586 we still managed to remove all the uses of `Marshal` in our own codebase to make the linter happy. Even though we wouldn't recommend the use of `Marshal`, this code at least enables it for anyone using a Rails cache or similar mechanism. Addresses #90.
brandur-stripe
force-pushed
the
brandur-reimplement-custom-marshal
branch
from
October 13, 2017 16:31
0a1d418
to
91099f9
Compare
Thanks OB! |
Released as 3.5.2. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backtracks a little bit #586 by bringing back custom
StripeObject
encoding and decoding methods for Ruby's
Marshal
. These work by justpersisting values and some opts, and skipping everything else. It's
mostly the same as what we had before, but implemented a little more
cleanly so that we don't actually need to invoke
Marshal
anywhereourselves.
In #586 we still managed to remove all the uses of
Marshal
in our owncodebase to make the linter happy. Even though we wouldn't recommend the
use of
Marshal
, this code at least enables it for anyone using a Railscache or similar mechanism.
Addresses #90.