-
Notifications
You must be signed in to change notification settings - Fork 1.4k
MONGOID-5408 .evolve should support wrapper class #5448
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
Merged
comandeo
merged 6 commits into
mongodb:master
from
johnnyshields:evolve-raw-value-wrapper
Feb 14, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
483e8ad
Add Mongoid::RawValue wrapper which can be passed into queries
johnnyshields 7284c78
Merge branch 'master' into evolve-raw-value-wrapper
johnnyshields a61a30e
Add code doc
johnnyshields a81a998
Update raw_value.rb
johnnyshields 92f38b3
Update selector.rb
johnnyshields f757a27
Update raw_value.rb
johnnyshields File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
# Wrapper class used when a value cannot be casted in evolve method. | ||
module Mongoid | ||
|
||
# Instantiates a new Mongoid::RawValue object. Used as a syntax shortcut. | ||
# | ||
# @example Create a Mongoid::RawValue object. | ||
# Mongoid::RawValue("Beagle") | ||
# | ||
# @return [ Mongoid::RawValue ] The object. | ||
def RawValue(*args) | ||
johnnyshields marked this conversation as resolved.
Show resolved
Hide resolved
johnnyshields marked this conversation as resolved.
Show resolved
Hide resolved
|
||
RawValue.new(*args) | ||
end | ||
|
||
class RawValue | ||
|
||
attr_reader :raw_value | ||
|
||
def initialize(raw_value) | ||
@raw_value = raw_value | ||
end | ||
|
||
# Returns a string containing a human-readable representation of | ||
# the object, including the inspection of the underlying value. | ||
# | ||
# @return [ String ] The object inspection. | ||
def inspect | ||
"RawValue: #{raw_value.inspect}" | ||
end | ||
end | ||
end |
Oops, something went wrong.
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.
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.
Here I copy-pasted the "Embedded Documents" section to be after "Fields" w/out edits to it, as I felt it made more sense order-wise vis-a-vis additions to Fields section in this PR.