bson 4.14.1-java → 4.15.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/bson/decimal128.rb +12 -2
- data/lib/bson/version.rb +1 -1
- data/lib/bson-ruby.jar +0 -0
- data/spec/bson/decimal128_spec.rb +215 -0
- data.tar.gz.sig +1 -1
- metadata +21 -20
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc99b74544db3686a580a0f25c2ef2a36e5d4c95dc17924d36285cc1e23b4f70
|
4
|
+
data.tar.gz: 387a4a3a3af6a56e980e93648d44d2b8196e76cc7f65ba494b8d6613d5580660
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e495d9ae63176d4d594d715f983cc1cf01d23761f383f079397ed2b24927c868c2c45a50d1943eb8bfccab4c8bfbd9a839830a8f6473b31a590a6408f531637c
|
7
|
+
data.tar.gz: f1750558d5e912736870d1d4e82c0ae5ca48eec13521efc8d504cb7483bdc2c2ec20912f47fc7ae30efd3d7e7111f9992e8b4c28e18280dc21b00848ac314979
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/bson/decimal128.rb
CHANGED
@@ -20,6 +20,7 @@ module BSON
|
|
20
20
|
|
21
21
|
class Decimal128
|
22
22
|
include JSON
|
23
|
+
include Comparable
|
23
24
|
|
24
25
|
# A Decimal128 is type 0x13 in the BSON spec.
|
25
26
|
#
|
@@ -97,7 +98,16 @@ module BSON
|
|
97
98
|
end
|
98
99
|
alias :eql? :==
|
99
100
|
|
100
|
-
|
101
|
+
def <=>(other)
|
102
|
+
to_big_decimal <=> case other
|
103
|
+
when Decimal128
|
104
|
+
other.to_big_decimal
|
105
|
+
else
|
106
|
+
other
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# Create a new Decimal128 from a string or a BigDecimal instance.
|
101
111
|
#
|
102
112
|
# @example Create a Decimal128 from a BigDecimal.
|
103
113
|
# Decimal128.new(big_decimal)
|
@@ -105,7 +115,7 @@ module BSON
|
|
105
115
|
# @param [ String, BigDecimal ] object The BigDecimal or String to use for
|
106
116
|
# instantiating a Decimal128.
|
107
117
|
#
|
108
|
-
# @raise [
|
118
|
+
# @raise [ InvalidArgument ] When argument is not a String or BigDecimal.
|
109
119
|
#
|
110
120
|
# @since 4.2.0
|
111
121
|
def initialize(object)
|
data/lib/bson/version.rb
CHANGED
data/lib/bson-ruby.jar
CHANGED
Binary file
|
@@ -1602,4 +1602,219 @@ describe BSON::Decimal128 do
|
|
1602
1602
|
expect(registered).to eq(described_class)
|
1603
1603
|
end
|
1604
1604
|
end
|
1605
|
+
|
1606
|
+
%w(== ===).each do |eq_op|
|
1607
|
+
let(:lhs) { described_class.new('1.2e12') }
|
1608
|
+
|
1609
|
+
describe "##{eq_op}" do
|
1610
|
+
context 'when rhs is equal to lhs' do
|
1611
|
+
context 'when both are Decimal128 instances' do
|
1612
|
+
let(:rhs) { described_class.new('1.2e12') }
|
1613
|
+
|
1614
|
+
it 'is true' do
|
1615
|
+
(lhs == rhs).should be true
|
1616
|
+
end
|
1617
|
+
end
|
1618
|
+
|
1619
|
+
context 'when rhs is of a different type' do
|
1620
|
+
[
|
1621
|
+
1200000000000,
|
1622
|
+
1200000000000.0,
|
1623
|
+
BigDecimal('1.2e12'),
|
1624
|
+
].each do |rhs|
|
1625
|
+
context "when rhs is #{rhs.class}" do
|
1626
|
+
it 'is true' do
|
1627
|
+
pending 'RUBY-2952'
|
1628
|
+
|
1629
|
+
(lhs == rhs).should be true
|
1630
|
+
end
|
1631
|
+
end
|
1632
|
+
end
|
1633
|
+
end
|
1634
|
+
end
|
1635
|
+
|
1636
|
+
context 'when rhs is not equal to lhs' do
|
1637
|
+
context 'when both are Decimal128 instances' do
|
1638
|
+
let(:rhs) { described_class.new('1.21e12') }
|
1639
|
+
|
1640
|
+
it 'is false' do
|
1641
|
+
(lhs == rhs).should be false
|
1642
|
+
end
|
1643
|
+
end
|
1644
|
+
|
1645
|
+
context 'when rhs is of a different type' do
|
1646
|
+
|
1647
|
+
[
|
1648
|
+
1200000000001,
|
1649
|
+
1200000000001.0,
|
1650
|
+
BigDecimal('1.21e12'),
|
1651
|
+
].each do |rhs|
|
1652
|
+
context "when rhs is #{rhs.class}" do
|
1653
|
+
it 'is false' do
|
1654
|
+
(lhs == rhs).should be false
|
1655
|
+
end
|
1656
|
+
end
|
1657
|
+
end
|
1658
|
+
end
|
1659
|
+
end
|
1660
|
+
end
|
1661
|
+
end
|
1662
|
+
|
1663
|
+
describe "#<=>" do
|
1664
|
+
|
1665
|
+
let(:lhs) { described_class.new('1.2e12') }
|
1666
|
+
|
1667
|
+
context 'when lhs is less than rhs' do
|
1668
|
+
context 'when both are Decimal128 instances' do
|
1669
|
+
let(:rhs) { described_class.new('1.21e12') }
|
1670
|
+
|
1671
|
+
it 'is -1' do
|
1672
|
+
(lhs <=> rhs).should be -1
|
1673
|
+
end
|
1674
|
+
end
|
1675
|
+
|
1676
|
+
context 'when rhs is of a different type' do
|
1677
|
+
[
|
1678
|
+
1200000000001,
|
1679
|
+
1200000000001.0,
|
1680
|
+
BigDecimal('1.21e12'),
|
1681
|
+
].each do |rhs|
|
1682
|
+
context "when rhs is #{rhs.class}" do
|
1683
|
+
it 'is -1' do
|
1684
|
+
(lhs <=> rhs).should be -1
|
1685
|
+
end
|
1686
|
+
end
|
1687
|
+
end
|
1688
|
+
end
|
1689
|
+
end
|
1690
|
+
|
1691
|
+
context 'when rhs is equal to lhs' do
|
1692
|
+
context 'when both are Decimal128 instances' do
|
1693
|
+
let(:rhs) { described_class.new('1.2e12') }
|
1694
|
+
|
1695
|
+
it 'is 0' do
|
1696
|
+
(lhs <=> rhs).should be 0
|
1697
|
+
end
|
1698
|
+
end
|
1699
|
+
|
1700
|
+
context 'when rhs is of a different type' do
|
1701
|
+
|
1702
|
+
[
|
1703
|
+
1200000000000,
|
1704
|
+
1200000000000.0,
|
1705
|
+
BigDecimal('1.2e12'),
|
1706
|
+
].each do |rhs|
|
1707
|
+
context "when rhs is #{rhs.class}" do
|
1708
|
+
it 'is 0' do
|
1709
|
+
(lhs <=> rhs).should be 0
|
1710
|
+
end
|
1711
|
+
end
|
1712
|
+
end
|
1713
|
+
end
|
1714
|
+
end
|
1715
|
+
|
1716
|
+
context 'when rhs is greater than lhs' do
|
1717
|
+
context 'when both are Decimal128 instances' do
|
1718
|
+
let(:rhs) { described_class.new('1.1e12') }
|
1719
|
+
|
1720
|
+
it 'is 1' do
|
1721
|
+
(lhs <=> rhs).should be 1
|
1722
|
+
end
|
1723
|
+
end
|
1724
|
+
|
1725
|
+
context 'when rhs is of a different type' do
|
1726
|
+
|
1727
|
+
[
|
1728
|
+
1100000000000,
|
1729
|
+
1100000000000.0,
|
1730
|
+
BigDecimal('1.1e12'),
|
1731
|
+
].each do |rhs|
|
1732
|
+
context "when rhs is #{rhs.class}" do
|
1733
|
+
it 'is 1' do
|
1734
|
+
(lhs <=> rhs).should be 1
|
1735
|
+
end
|
1736
|
+
end
|
1737
|
+
end
|
1738
|
+
end
|
1739
|
+
end
|
1740
|
+
end
|
1741
|
+
|
1742
|
+
describe "#<" do
|
1743
|
+
|
1744
|
+
let(:lhs) { described_class.new('1.2e12') }
|
1745
|
+
|
1746
|
+
context 'when lhs is less than rhs' do
|
1747
|
+
context 'when both are Decimal128 instances' do
|
1748
|
+
let(:rhs) { described_class.new('1.21e12') }
|
1749
|
+
|
1750
|
+
it 'is true' do
|
1751
|
+
(lhs < rhs).should be true
|
1752
|
+
end
|
1753
|
+
end
|
1754
|
+
|
1755
|
+
context 'when rhs is of a different type' do
|
1756
|
+
[
|
1757
|
+
1200000000001,
|
1758
|
+
1200000000001.0,
|
1759
|
+
BigDecimal('1.21e12'),
|
1760
|
+
].each do |rhs|
|
1761
|
+
context "when rhs is #{rhs.class}" do
|
1762
|
+
it 'is true' do
|
1763
|
+
(lhs < rhs).should be true
|
1764
|
+
end
|
1765
|
+
end
|
1766
|
+
end
|
1767
|
+
end
|
1768
|
+
end
|
1769
|
+
|
1770
|
+
context 'when rhs is equal to lhs' do
|
1771
|
+
context 'when both are Decimal128 instances' do
|
1772
|
+
let(:rhs) { described_class.new('1.2e12') }
|
1773
|
+
|
1774
|
+
it 'is false' do
|
1775
|
+
(lhs < rhs).should be false
|
1776
|
+
end
|
1777
|
+
end
|
1778
|
+
|
1779
|
+
context 'when rhs is of a different type' do
|
1780
|
+
|
1781
|
+
[
|
1782
|
+
1200000000000,
|
1783
|
+
1200000000000.0,
|
1784
|
+
BigDecimal('1.2e12'),
|
1785
|
+
].each do |rhs|
|
1786
|
+
context "when rhs is #{rhs.class}" do
|
1787
|
+
it 'is false' do
|
1788
|
+
(lhs < rhs).should be false
|
1789
|
+
end
|
1790
|
+
end
|
1791
|
+
end
|
1792
|
+
end
|
1793
|
+
end
|
1794
|
+
|
1795
|
+
context 'when rhs is greater than lhs' do
|
1796
|
+
context 'when both are Decimal128 instances' do
|
1797
|
+
let(:rhs) { described_class.new('1.1e12') }
|
1798
|
+
|
1799
|
+
it 'is false' do
|
1800
|
+
(lhs < rhs).should be false
|
1801
|
+
end
|
1802
|
+
end
|
1803
|
+
|
1804
|
+
context 'when rhs is of a different type' do
|
1805
|
+
|
1806
|
+
[
|
1807
|
+
1100000000000,
|
1808
|
+
1100000000000.0,
|
1809
|
+
BigDecimal('1.1e12'),
|
1810
|
+
].each do |rhs|
|
1811
|
+
context "when rhs is #{rhs.class}" do
|
1812
|
+
it 'is false' do
|
1813
|
+
(lhs < rhs).should be false
|
1814
|
+
end
|
1815
|
+
end
|
1816
|
+
end
|
1817
|
+
end
|
1818
|
+
end
|
1819
|
+
end
|
1605
1820
|
end
|
data.tar.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Y�l ������!�{�ۆ!FnK�MK��T�`~\��Kt}$�5��"f2�^Z�i�.��1{ =2���N�ȗq &��M8-+� ���g ��!�.Y����n/��<5�s,e;R�`N�� Vv��J].`s���kE��dr.�\�N���إ�Wn��-�('�+��,B�\�����(��V�� 6�5�\�]��w�;��a�[��20���#��J�a��\8��uSC���?d=q�"�4]y1���.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.15.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -14,26 +14,27 @@ bindir: bin
|
|
14
14
|
cert_chain:
|
15
15
|
- |
|
16
16
|
-----BEGIN CERTIFICATE-----
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
17
|
+
MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtkcml2
|
18
|
+
ZXItcnVieTEVMBMGCgmSJomT8ixkARkWBTEwZ2VuMRMwEQYKCZImiZPyLGQBGRYD
|
19
|
+
Y29tMB4XDTIyMDMzMDE5MTcwMloXDTIzMDMzMDE5MTcwMlowQjEUMBIGA1UEAwwL
|
20
|
+
ZHJpdmVyLXJ1YnkxFTATBgoJkiaJk/IsZAEZFgUxMGdlbjETMBEGCgmSJomT8ixk
|
21
|
+
ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANFdSAa8fRm1
|
22
|
+
bAM9za6Z0fAH4g02bqM1NGnw8zJQrE/PFrFfY6IFCT2AsLfOwr1maVm7iU1+kdVI
|
23
|
+
IQ+iI/9+E+ArJ+rbGV3dDPQ+SLl3mLT+vXjfjcxMqI2IW6UuVtt2U3Rxd4QU0kdT
|
24
|
+
JxmcPYs5fDN6BgYc6XXgUjy3m+Kwha2pGctdciUOwEfOZ4RmNRlEZKCMLRHdFP8j
|
25
|
+
4WTnJSGfXDiuoXICJb5yOPOZPuaapPSNXp93QkUdsqdKC32I+KMpKKYGBQ6yisfA
|
26
|
+
5MyVPPCzLR1lP5qXVGJPnOqUAkvEUfCahg7EP9tI20qxiXrR6TSEraYhIFXL0EGY
|
27
|
+
u8KAcPHm5KkCAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
28
|
+
BBYEFFt3WbF+9JpUjAoj62cQBgNb8HzXMCAGA1UdEQQZMBeBFWRyaXZlci1ydWJ5
|
29
|
+
QDEwZ2VuLmNvbTAgBgNVHRIEGTAXgRVkcml2ZXItcnVieUAxMGdlbi5jb20wDQYJ
|
30
|
+
KoZIhvcNAQEFBQADggEBAM0s7jz2IGD8Ms035b1tMnbNP2CBPq3pen3KQj7IkGF7
|
31
|
+
x8LPDdOqUj4pUMLeefntX/PkSvwROo677TnWK6+GLayGm5xLHrZH3svybC6QtqTR
|
32
|
+
mVOLUoZ4TgUmtnMUa/ZvgrIsOeiCysjSf4WECuw7g+LE6jcpLepgYTLk2u1+5SgH
|
33
|
+
JVENj0BMkdeZIKkc2G97DSx3Zrmz7QWAaH+99XlajJbfcgvhDso+ffQkTBlOgLBg
|
34
|
+
+WyKQ+QTIdtDiyf2LQmxWnxt/W1CmScjdLS7/yXGkkB/D9Uy+sJD747O/B9P238Q
|
35
|
+
XnerrtyOu04RsWDvaZkCwSDVzoqfICh4CP1mlde73Ts=
|
35
36
|
-----END CERTIFICATE-----
|
36
|
-
date: 2022-
|
37
|
+
date: 2022-04-21 00:00:00.000000000 Z
|
37
38
|
dependencies: []
|
38
39
|
description: A fully featured BSON specification implementation in Ruby
|
39
40
|
email:
|
metadata.gz.sig
CHANGED
Binary file
|