@@ -227,16 +227,16 @@ specific to the specification:
227
227
``BSON::Binary``
228
228
~~~~~~~~~~~~~~~~
229
229
230
- Use ``BSON::Binary`` objects to store arbitrary binary data. The ``Binary``
231
- objects can be constructed from binary strings as follows :
230
+ Use ``BSON::Binary`` objects to store arbitrary binary data. You can construct
231
+ ``Binary`` objects from binary strings, as shown in the following code :
232
232
233
233
.. code-block:: ruby
234
234
235
235
BSON::Binary.new("binary_string")
236
236
# => <BSON::Binary:0x47113101192900 type=generic data=0x62696e6172795f73...>
237
237
238
238
By default, ``Binary`` objects are created with BSON binary subtype 0
239
- (``:generic``). The subtype can be explicitly specified to indicate that
239
+ (``:generic``). You can explicitly specify the subtype to indicate that
240
240
the bytes encode a particular type of data:
241
241
242
242
.. code-block:: ruby
@@ -247,8 +247,8 @@ the bytes encode a particular type of data:
247
247
Valid subtypes are ``:generic``, ``:function``, ``:old``, ``:uuid_old``,
248
248
``:uuid``, ``:md5`` and ``:user``.
249
249
250
- The data and the subtype can be retrieved from ``Binary `` instances using
251
- ``data `` and ``type`` attributes , as follows :
250
+ You can use the ``data`` and ``type `` attributes to retrieve a
251
+ ``Binary `` object's data and the subtype , as shown in the following code :
252
252
253
253
.. code-block:: ruby
254
254
@@ -258,6 +258,10 @@ The data and the subtype can be retrieved from ``Binary`` instances using
258
258
binary.type
259
259
=> :user
260
260
261
+ You can compare ``Binary`` objects by using the ``<=>`` operator, which allows
262
+ you to sort objects that have the same binary subtype. To compare ``Binary`` objects,
263
+ ensure that you install v5.0.2 or later of the BSON library.
264
+
261
265
.. note::
262
266
263
267
``BSON::Binary`` objects always store the data in ``BINARY`` encoding,
0 commit comments