Class: BSON::MinKey
- Inherits:
-
Object
- Object
- BSON::MinKey
- Includes:
- JSON, Specialized, Comparable
- Defined in:
- lib/bson/min_key.rb
Overview
Represents a $minKey type, which compares less than any other value in the specification.
Constant Summary collapse
- BSON_TYPE =
A $minKey is type 0xFF in the BSON spec.
::String.new(255.chr, encoding: BINARY).freeze
- LESSER =
Constant for always evaluating lesser in a comparison.
-1
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
When comparing a min key with any other object, the min key will always be lesser.
-
#as_extended_json(**options) ⇒ Hash
Converts this object to a representation directly serializable to Extended JSON (github.com/mongodb/specifications/blob/master/source/extended-json/extended-json.md).
-
#as_json(*_args) ⇒ Hash
Return a representation of the object for use in application-level JSON serialization.
Methods included from Specialized
Methods included from JSON
Instance Method Details
#<=>(other) ⇒ Integer
When comparing a min key with any other object, the min key will always be lesser.
51 52 53 |
# File 'lib/bson/min_key.rb', line 51 def <=>(other) LESSER end |
#as_extended_json(**options) ⇒ Hash
Converts this object to a representation directly serializable to Extended JSON (github.com/mongodb/specifications/blob/master/source/extended-json/extended-json.md).
72 73 74 |
# File 'lib/bson/min_key.rb', line 72 def as_extended_json(**) { "$minKey" => 1 } end |
#as_json(*_args) ⇒ Hash
Return a representation of the object for use in application-level JSON serialization. Since BSON::MinKey is used exclusively in BSON-related contexts, this method returns the canonical Extended JSON representation.
61 62 63 |
# File 'lib/bson/min_key.rb', line 61 def as_json(*_args) as_extended_json end |