@@ -26,35 +26,34 @@ To install the gem manually:
2626
2727.. code-block:: sh
2828
29- gem install bson
29+ gem install bson -v '~> 4.0'
3030
3131To install the gem with bundler, include the following in your Gemfile:
3232
3333.. code-block:: ruby
3434
3535 gem 'bson', '~> 4.0'
3636
37- The BSON gem is compatible with MRI 1.9.3, 2.0.x, 2.1.x, 2.2.x, JRuby 1.7.x, and
38- Rubinius 2.5.x
37+ The BSON gem is compatible with MRI >= 1.9.3, JRuby 1.7.x, and Rubinius 2.5.x
3938
4039BSON Serialization
4140------------------
4241
4342Getting a Ruby object's raw BSON representation is done by calling ``to_bson``
44- on the Ruby object, which will return a ``ByteBuffer``. For example:
43+ on the Ruby object, which will return a ``BSON:: ByteBuffer``. For example:
4544
4645.. code-block:: ruby
4746
4847 "Shall I compare thee to a summer's day".to_bson
4948 1024.to_bson
5049
5150Generating an object from BSON is done via calling ``from_bson`` on the class
52- you wish to instantiate and passing it a ``ByteBuffer`` instance.
51+ you wish to instantiate and passing it a ``BSON:: ByteBuffer`` instance.
5352
5453.. code-block:: ruby
5554
5655 String.from_bson(byte_buffer)
57- Int32.from_bson(byte_buffer)
56+ BSON:: Int32.from_bson(byte_buffer)
5857
5958Byte Buffers
6059------------
@@ -90,14 +89,14 @@ Reading from the buffer is done via the following API:
9089
9190 buffer.get_byte # Pulls a single byte from the buffer.
9291 buffer.get_bytes(value) # Pulls n number of bytes from the buffer.
93- buffer.get_cstring # Pulls a null-terminted string from the buffer.
92+ buffer.get_cstring # Pulls a null-terminated string from the buffer.
9493 buffer.get_double # Pulls a 64-bit floating point from the buffer.
9594 buffer.get_int32 # Pulls a 32-bit integer (4 bytes) from the buffer.
9695 buffer.get_int64 # Pulls a 64-bit integer (8 bytes) from the buffer.
9796 buffer.get_string # Pulls a UTF-8 string from the buffer.
9897
99- Convertig a buffer to it's raw bytes, for example to send over a socket,
100- is done by simply calling `to_s` on the buffer.
98+ Converting a buffer to its raw bytes ( for example, for sending over a socket)
99+ is done by simply calling `` to_s` ` on the buffer.
101100
102101.. code-block:: ruby
103102
@@ -119,20 +118,20 @@ specific to the specification:
119118``BSON::Binary``
120119````````````````
121120
122- This is a representation of binary data, and must provide the raw data and
123- a subtype when constructing.
121+ This is a representation of binary data. The raw data and a subtype must be
122+ provided when constructing.
124123
125124.. code-block:: ruby
126125
127126 BSON::Binary.new(binary_data, :md5)
128127
129- Valid subtypes are: ``:generic``, ``:function``, ``:old``, ``:uuid_old``, ``:uuid``,
130- ``:md5``, ``:user``.
128+ Valid subtypes are: ``:generic``, ``:function``, ``:old``, ``:uuid_old``,
129+ ``:uuid``, ``: md5``, ``:user``.
131130
132131``BSON::Code``
133132``````````````
134133
135- Represents a string of Javascript code.
134+ Represents a string of JavaScript code.
136135
137136.. code-block:: ruby
138137
@@ -141,7 +140,7 @@ Represents a string of Javascript code.
141140``BSON::CodeWithScope``
142141```````````````````````
143142
144- Represents a string of Javascript code with a hash of values.
143+ Represents a string of JavaScript code with a hash of values.
145144
146145.. code-block:: ruby
147146
@@ -150,8 +149,8 @@ Represents a string of Javascript code with a hash of values.
150149``BSON::Document``
151150``````````````````
152151
153- This is a subclass of a hash that stores all keys as strings but allows access to
154- them with symbol keys.
152+ This is a subclass of ``Hash`` that stores all keys as strings, but allows
153+ access to them with symbol keys.
155154
156155.. code-block:: ruby
157156
@@ -206,8 +205,8 @@ Represents a placeholder for a value that was not provided.
206205``BSON::Decimal128``
207206````````````````````
208207
209- Represents a 128-bit decimal-based floating-point value capable of
210- emulating decimal rounding with exact precision. .
208+ Represents a 128-bit decimal-based floating-point value capable of emulating
209+ decimal rounding with exact precision.
211210
212211.. code-block:: ruby
213212
@@ -260,8 +259,8 @@ them.
260259Special Ruby Date Classes
261260-------------------------
262261
263- Ruby's ``Date`` and ``DateTime`` are able to be serialized, but when
264- they are deserialized they will always be returned as a ``Time`` since the BSON
262+ Ruby's ``Date`` and ``DateTime`` are able to be serialized, but when they are
263+ deserialized, they will always be returned as a ``Time`` since the BSON
265264specification only has a ``Time`` type and knows nothing about Ruby.
266265
267266
@@ -302,7 +301,7 @@ Please use the ``Regexp::Raw`` class to instantiate your BSON regular expression
302301pattern and options you want.
303302
304303When regular expressions are deserialized, they return a wrapper that holds the
305- raw regex string, but does not compile it. In order to get the Ruby ``Regexp``
304+ raw regex string, but do not compile it. In order to get the Ruby ``Regexp``
306305object, one must call ``compile`` on the returned object.
307306
308307.. code-block:: ruby
0 commit comments