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