Skip to content

Commit 2a56cec

Browse files
committed
RUBY-1161 Add Decimal128 example to docs
1 parent a22686e commit 2a56cec

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docs/tutorials/bson-v4.txt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ is done by simply calling `to_s` on the buffer.
108108
Supported Objects
109109
-----------------
110110

111-
Core Ruby object's that have representations in the BSON specification and
111+
Core Ruby objects that have representations in the BSON specification and
112112
will have a ``to_bson`` method defined for them are: ``Object``, ``Array``,
113113
``FalseClass``, ``Float``, ``Hash``, ``Integer``, ``NilClass``, ``Regexp``,
114114
``String``, ``Symbol`` (deprecated), ``Time``, ``TrueClass``.
@@ -203,6 +203,21 @@ Represents a placeholder for a value that was not provided.
203203

204204
BSON::Undefined.new
205205

206+
``BSON::Decimal128``
207+
```````````````````
208+
209+
Represents a 128-bit decimal-based floating-point value capable of
210+
emulating decimal rounding with exact precision..
211+
212+
.. code-block:: ruby
213+
214+
# Instantiate with a String
215+
BSON::Decimal128.new("1.28")
216+
217+
# Instantiate with a BigDecimal
218+
d = BigDecimal.new(1.28, 3)
219+
BSON::Decimal128.new(d)
220+
206221
JSON Serialization
207222
------------------
208223

@@ -261,5 +276,5 @@ object, one must call ``compile`` on the returned object.
261276

262277
regex = Regexp.from_bson(byte_buffer)
263278
regex.pattern #=> Returns the pattern as a string.
264-
regex.options #=> Returns the raw options as an int.
279+
regex.options #=> Returns the raw options as a String.
265280
regex.compile #=> Returns the compiled Ruby Regexp object.

0 commit comments

Comments
 (0)