-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MONGOID-5408 .evolve should support wrapper class (#5448)
Co-authored-by: shields <[email protected]>
- Loading branch information
1 parent
5295b32
commit 67c211d
Showing
9 changed files
with
791 additions
and
36 deletions.
There are no files selected for viewing
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
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
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
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
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
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) | ||
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.