BSON::ObjectId#inspect returns a string that evals into an object id #38
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.
This will let
BSON::ObjectId#inspect
to return a string that can be evaluated into an equivalent object id. This would be super useful for copying and pasting object ids (especially when used with Mongoid).A
BSON.ObjectId
constructor method passes the argument to#from_string
, allowing object ids to behave kinda like literals.Seemingly sending an arg to a constant as a constructor is similar to some behavior found in the standard lib:
Pathname('./lib')
orHash(a: 1, b: 2)
If this is helpful, perhaps something similar can be implemented for
BSON::Binary
as well.Now
Before (990c7157)
Way Before (27d9a915)
Hope this helps!