blackbox 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +1 -0
- data/coverage/.resultset.json +1 -2
- data/coverage/index.html +91 -97
- data/doc/BB/Crypto.html +1 -1
- data/doc/BB/Hash.html +1 -1
- data/doc/BB/Number.html +901 -0
- data/doc/BB/String.html +1 -1
- data/doc/BB.html +2 -2
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/top-level-namespace.html +1 -1
- data/lib/blackbox/number.rb +1 -2
- data/lib/blackbox/version.rb +1 -1
- metadata +2 -1
data/coverage/index.html
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
<img src="./assets/0.7.1/loading.gif" alt="loading"/>
|
15
15
|
</div>
|
16
16
|
<div id="wrapper" style="display:none;">
|
17
|
-
<div class="timestamp">Generated <abbr class="timeago" title="2015-11-22T18:
|
17
|
+
<div class="timestamp">Generated <abbr class="timeago" title="2015-11-22T18:31:12+01:00">2015-11-22T18:31:12+01:00</abbr></div>
|
18
18
|
<ul class="group_tabs"></ul>
|
19
19
|
|
20
20
|
<div id="content">
|
@@ -73,7 +73,7 @@
|
|
73
73
|
<tr>
|
74
74
|
<td class="strong"><a href="#7a135b0407697dbb00ab589a4ca6477d724b7276" class="src_link" title="lib/blackbox/number.rb">lib/blackbox/number.rb</a></td>
|
75
75
|
<td class="green strong">91.11 %</td>
|
76
|
-
<td>
|
76
|
+
<td>166</td>
|
77
77
|
<td>45</td>
|
78
78
|
<td>41</td>
|
79
79
|
<td>4</td>
|
@@ -1503,544 +1503,538 @@
|
|
1503
1503
|
<li class="missed" data-hits="0" data-linenumber="77">
|
1504
1504
|
|
1505
1505
|
|
1506
|
-
<code class="ruby">
|
1506
|
+
<code class="ruby"> number</code>
|
1507
1507
|
</li>
|
1508
1508
|
|
1509
1509
|
<li class="never" data-hits="" data-linenumber="78">
|
1510
1510
|
|
1511
1511
|
|
1512
|
-
<code class="ruby"> #number</code>
|
1513
|
-
</li>
|
1514
|
-
|
1515
|
-
<li class="never" data-hits="" data-linenumber="79">
|
1516
|
-
|
1517
|
-
|
1518
1512
|
<code class="ruby"> end</code>
|
1519
1513
|
</li>
|
1520
1514
|
|
1521
|
-
<li class="never" data-hits="" data-linenumber="
|
1515
|
+
<li class="never" data-hits="" data-linenumber="79">
|
1522
1516
|
|
1523
1517
|
|
1524
1518
|
<code class="ruby"> end</code>
|
1525
1519
|
</li>
|
1526
1520
|
|
1527
|
-
<li class="never" data-hits="" data-linenumber="
|
1521
|
+
<li class="never" data-hits="" data-linenumber="80">
|
1528
1522
|
|
1529
1523
|
|
1530
1524
|
<code class="ruby"> end</code>
|
1531
1525
|
</li>
|
1532
1526
|
|
1533
|
-
<li class="never" data-hits="" data-linenumber="
|
1527
|
+
<li class="never" data-hits="" data-linenumber="81">
|
1534
1528
|
|
1535
1529
|
|
1536
1530
|
<code class="ruby"></code>
|
1537
1531
|
</li>
|
1538
1532
|
|
1539
|
-
<li class="never" data-hits="" data-linenumber="
|
1533
|
+
<li class="never" data-hits="" data-linenumber="82">
|
1540
1534
|
|
1541
1535
|
|
1542
1536
|
<code class="ruby"> ##</code>
|
1543
1537
|
</li>
|
1544
1538
|
|
1545
|
-
<li class="never" data-hits="" data-linenumber="
|
1539
|
+
<li class="never" data-hits="" data-linenumber="83">
|
1546
1540
|
|
1547
1541
|
|
1548
1542
|
<code class="ruby"> # Formats a +number+ with the specified level of <tt>:precision</tt> (e.g., 112.32 has a precision of 2).</code>
|
1549
1543
|
</li>
|
1550
1544
|
|
1551
|
-
<li class="never" data-hits="" data-linenumber="
|
1545
|
+
<li class="never" data-hits="" data-linenumber="84">
|
1552
1546
|
|
1553
1547
|
|
1554
1548
|
<code class="ruby"> # You can customize the format in the +options+ hash.</code>
|
1555
1549
|
</li>
|
1556
1550
|
|
1557
|
-
<li class="never" data-hits="" data-linenumber="
|
1551
|
+
<li class="never" data-hits="" data-linenumber="85">
|
1558
1552
|
|
1559
1553
|
|
1560
1554
|
<code class="ruby"> #</code>
|
1561
1555
|
</li>
|
1562
1556
|
|
1563
|
-
<li class="never" data-hits="" data-linenumber="
|
1557
|
+
<li class="never" data-hits="" data-linenumber="86">
|
1564
1558
|
|
1565
1559
|
|
1566
1560
|
<code class="ruby"> # @overload with_precision(number, options={})</code>
|
1567
1561
|
</li>
|
1568
1562
|
|
1569
|
-
<li class="never" data-hits="" data-linenumber="
|
1563
|
+
<li class="never" data-hits="" data-linenumber="87">
|
1570
1564
|
|
1571
1565
|
|
1572
1566
|
<code class="ruby"> # @param [Fixnum, Float] number</code>
|
1573
1567
|
</li>
|
1574
1568
|
|
1575
|
-
<li class="never" data-hits="" data-linenumber="
|
1569
|
+
<li class="never" data-hits="" data-linenumber="88">
|
1576
1570
|
|
1577
1571
|
|
1578
1572
|
<code class="ruby"> # Number value to format.</code>
|
1579
1573
|
</li>
|
1580
1574
|
|
1581
|
-
<li class="never" data-hits="" data-linenumber="
|
1575
|
+
<li class="never" data-hits="" data-linenumber="89">
|
1582
1576
|
|
1583
1577
|
|
1584
1578
|
<code class="ruby"> # @param [Hash] options</code>
|
1585
1579
|
</li>
|
1586
1580
|
|
1587
|
-
<li class="never" data-hits="" data-linenumber="
|
1581
|
+
<li class="never" data-hits="" data-linenumber="90">
|
1588
1582
|
|
1589
1583
|
|
1590
1584
|
<code class="ruby"> # Options for formatter.</code>
|
1591
1585
|
</li>
|
1592
1586
|
|
1593
|
-
<li class="never" data-hits="" data-linenumber="
|
1587
|
+
<li class="never" data-hits="" data-linenumber="91">
|
1594
1588
|
|
1595
1589
|
|
1596
1590
|
<code class="ruby"> # @option options [Fixnum] :precision (3)</code>
|
1597
1591
|
</li>
|
1598
1592
|
|
1599
|
-
<li class="never" data-hits="" data-linenumber="
|
1593
|
+
<li class="never" data-hits="" data-linenumber="92">
|
1600
1594
|
|
1601
1595
|
|
1602
1596
|
<code class="ruby"> # Sets the level of precision.</code>
|
1603
1597
|
</li>
|
1604
1598
|
|
1605
|
-
<li class="never" data-hits="" data-linenumber="
|
1599
|
+
<li class="never" data-hits="" data-linenumber="93">
|
1606
1600
|
|
1607
1601
|
|
1608
1602
|
<code class="ruby"> # @option options [String] :separator (".")</code>
|
1609
1603
|
</li>
|
1610
1604
|
|
1611
|
-
<li class="never" data-hits="" data-linenumber="
|
1605
|
+
<li class="never" data-hits="" data-linenumber="94">
|
1612
1606
|
|
1613
1607
|
|
1614
1608
|
<code class="ruby"> # Sets the separator between the units.</code>
|
1615
1609
|
</li>
|
1616
1610
|
|
1617
|
-
<li class="never" data-hits="" data-linenumber="
|
1611
|
+
<li class="never" data-hits="" data-linenumber="95">
|
1618
1612
|
|
1619
1613
|
|
1620
1614
|
<code class="ruby"> # @option options [String] :delimiter ("")</code>
|
1621
1615
|
</li>
|
1622
1616
|
|
1623
|
-
<li class="never" data-hits="" data-linenumber="
|
1617
|
+
<li class="never" data-hits="" data-linenumber="96">
|
1624
1618
|
|
1625
1619
|
|
1626
1620
|
<code class="ruby"> # Sets the thousands delimiter.</code>
|
1627
1621
|
</li>
|
1628
1622
|
|
1629
|
-
<li class="never" data-hits="" data-linenumber="
|
1623
|
+
<li class="never" data-hits="" data-linenumber="97">
|
1630
1624
|
|
1631
1625
|
|
1632
1626
|
<code class="ruby"> #</code>
|
1633
1627
|
</li>
|
1634
1628
|
|
1635
|
-
<li class="never" data-hits="" data-linenumber="
|
1629
|
+
<li class="never" data-hits="" data-linenumber="98">
|
1636
1630
|
|
1637
1631
|
|
1638
1632
|
<code class="ruby"> # @return [String] The formatted representation of the number.</code>
|
1639
1633
|
</li>
|
1640
1634
|
|
1641
|
-
<li class="never" data-hits="" data-linenumber="
|
1635
|
+
<li class="never" data-hits="" data-linenumber="99">
|
1642
1636
|
|
1643
1637
|
|
1644
1638
|
<code class="ruby"> #</code>
|
1645
1639
|
</li>
|
1646
1640
|
|
1647
|
-
<li class="never" data-hits="" data-linenumber="
|
1641
|
+
<li class="never" data-hits="" data-linenumber="100">
|
1648
1642
|
|
1649
1643
|
|
1650
1644
|
<code class="ruby"> # @example</code>
|
1651
1645
|
</li>
|
1652
1646
|
|
1653
|
-
<li class="never" data-hits="" data-linenumber="
|
1647
|
+
<li class="never" data-hits="" data-linenumber="101">
|
1654
1648
|
|
1655
1649
|
|
1656
1650
|
<code class="ruby"> # with_precision(111.2345) # => 111.235</code>
|
1657
1651
|
</li>
|
1658
1652
|
|
1659
|
-
<li class="never" data-hits="" data-linenumber="
|
1653
|
+
<li class="never" data-hits="" data-linenumber="102">
|
1660
1654
|
|
1661
1655
|
|
1662
1656
|
<code class="ruby"> # with_precision(111.2345, :precision => 2) # => 111.23</code>
|
1663
1657
|
</li>
|
1664
1658
|
|
1665
|
-
<li class="never" data-hits="" data-linenumber="
|
1659
|
+
<li class="never" data-hits="" data-linenumber="103">
|
1666
1660
|
|
1667
1661
|
|
1668
1662
|
<code class="ruby"> # with_precision(13, :precision => 5) # => 13.00000</code>
|
1669
1663
|
</li>
|
1670
1664
|
|
1671
|
-
<li class="never" data-hits="" data-linenumber="
|
1665
|
+
<li class="never" data-hits="" data-linenumber="104">
|
1672
1666
|
|
1673
1667
|
|
1674
1668
|
<code class="ruby"> # with_precision(389.32314, :precision => 0) # => 389</code>
|
1675
1669
|
</li>
|
1676
1670
|
|
1677
|
-
<li class="never" data-hits="" data-linenumber="
|
1671
|
+
<li class="never" data-hits="" data-linenumber="105">
|
1678
1672
|
|
1679
1673
|
|
1680
1674
|
<code class="ruby"> # with_precision(1111.2345, :precision => 2, :separator => ',', :delimiter => '.')</code>
|
1681
1675
|
</li>
|
1682
1676
|
|
1683
|
-
<li class="never" data-hits="" data-linenumber="
|
1677
|
+
<li class="never" data-hits="" data-linenumber="106">
|
1684
1678
|
|
1685
1679
|
|
1686
1680
|
<code class="ruby"> # # => 1.111,23</code>
|
1687
1681
|
</li>
|
1688
1682
|
|
1689
|
-
<li class="never" data-hits="" data-linenumber="
|
1683
|
+
<li class="never" data-hits="" data-linenumber="107">
|
1690
1684
|
|
1691
1685
|
|
1692
1686
|
<code class="ruby"> #</code>
|
1693
1687
|
</li>
|
1694
1688
|
|
1695
|
-
<li class="covered" data-hits="1" data-linenumber="
|
1689
|
+
<li class="covered" data-hits="1" data-linenumber="108">
|
1696
1690
|
<span class="hits">1</span>
|
1697
1691
|
|
1698
1692
|
<code class="ruby"> def with_precision(number, args)</code>
|
1699
1693
|
</li>
|
1700
1694
|
|
1701
|
-
<li class="covered" data-hits="11" data-linenumber="
|
1695
|
+
<li class="covered" data-hits="11" data-linenumber="109">
|
1702
1696
|
<span class="hits">11</span>
|
1703
1697
|
|
1704
1698
|
<code class="ruby"> options = BB::Hash.symbolize_keys(args)</code>
|
1705
1699
|
</li>
|
1706
1700
|
|
1707
|
-
<li class="never" data-hits="" data-linenumber="
|
1701
|
+
<li class="never" data-hits="" data-linenumber="110">
|
1708
1702
|
|
1709
1703
|
|
1710
1704
|
<code class="ruby"></code>
|
1711
1705
|
</li>
|
1712
1706
|
|
1713
|
-
<li class="covered" data-hits="11" data-linenumber="
|
1707
|
+
<li class="covered" data-hits="11" data-linenumber="111">
|
1714
1708
|
<span class="hits">11</span>
|
1715
1709
|
|
1716
1710
|
<code class="ruby"> precision ||= (options[:precision] || 3)</code>
|
1717
1711
|
</li>
|
1718
1712
|
|
1719
|
-
<li class="covered" data-hits="11" data-linenumber="
|
1713
|
+
<li class="covered" data-hits="11" data-linenumber="112">
|
1720
1714
|
<span class="hits">11</span>
|
1721
1715
|
|
1722
1716
|
<code class="ruby"> separator ||= (options[:separator] || '.')</code>
|
1723
1717
|
</li>
|
1724
1718
|
|
1725
|
-
<li class="covered" data-hits="11" data-linenumber="
|
1719
|
+
<li class="covered" data-hits="11" data-linenumber="113">
|
1726
1720
|
<span class="hits">11</span>
|
1727
1721
|
|
1728
1722
|
<code class="ruby"> delimiter ||= (options[:delimiter] || '')</code>
|
1729
1723
|
</li>
|
1730
1724
|
|
1731
|
-
<li class="never" data-hits="" data-linenumber="
|
1725
|
+
<li class="never" data-hits="" data-linenumber="114">
|
1732
1726
|
|
1733
1727
|
|
1734
1728
|
<code class="ruby"></code>
|
1735
1729
|
</li>
|
1736
1730
|
|
1737
|
-
<li class="covered" data-hits="11" data-linenumber="
|
1731
|
+
<li class="covered" data-hits="11" data-linenumber="115">
|
1738
1732
|
<span class="hits">11</span>
|
1739
1733
|
|
1740
1734
|
<code class="ruby"> begin</code>
|
1741
1735
|
</li>
|
1742
1736
|
|
1743
|
-
<li class="covered" data-hits="11" data-linenumber="
|
1737
|
+
<li class="covered" data-hits="11" data-linenumber="116">
|
1744
1738
|
<span class="hits">11</span>
|
1745
1739
|
|
1746
1740
|
<code class="ruby"> rounded_number = (Float(number) * (10 ** precision)).round.to_f / 10 ** precision</code>
|
1747
1741
|
</li>
|
1748
1742
|
|
1749
|
-
<li class="covered" data-hits="11" data-linenumber="
|
1743
|
+
<li class="covered" data-hits="11" data-linenumber="117">
|
1750
1744
|
<span class="hits">11</span>
|
1751
1745
|
|
1752
1746
|
<code class="ruby"> with_delimiter("%01.#{precision}f" % rounded_number,</code>
|
1753
1747
|
</li>
|
1754
1748
|
|
1755
|
-
<li class="never" data-hits="" data-linenumber="
|
1749
|
+
<li class="never" data-hits="" data-linenumber="118">
|
1756
1750
|
|
1757
1751
|
|
1758
1752
|
<code class="ruby"> :separator => separator,</code>
|
1759
1753
|
</li>
|
1760
1754
|
|
1761
|
-
<li class="never" data-hits="" data-linenumber="
|
1755
|
+
<li class="never" data-hits="" data-linenumber="119">
|
1762
1756
|
|
1763
1757
|
|
1764
1758
|
<code class="ruby"> :delimiter => delimiter)</code>
|
1765
1759
|
</li>
|
1766
1760
|
|
1767
|
-
<li class="never" data-hits="" data-linenumber="
|
1761
|
+
<li class="never" data-hits="" data-linenumber="120">
|
1768
1762
|
|
1769
1763
|
|
1770
1764
|
<code class="ruby"> rescue</code>
|
1771
1765
|
</li>
|
1772
1766
|
|
1773
|
-
<li class="missed" data-hits="0" data-linenumber="
|
1767
|
+
<li class="missed" data-hits="0" data-linenumber="121">
|
1774
1768
|
|
1775
1769
|
|
1776
1770
|
<code class="ruby"> number</code>
|
1777
1771
|
</li>
|
1778
1772
|
|
1779
|
-
<li class="never" data-hits="" data-linenumber="
|
1773
|
+
<li class="never" data-hits="" data-linenumber="122">
|
1780
1774
|
|
1781
1775
|
|
1782
1776
|
<code class="ruby"> end</code>
|
1783
1777
|
</li>
|
1784
1778
|
|
1785
|
-
<li class="never" data-hits="" data-linenumber="
|
1779
|
+
<li class="never" data-hits="" data-linenumber="123">
|
1786
1780
|
|
1787
1781
|
|
1788
1782
|
<code class="ruby"> end</code>
|
1789
1783
|
</li>
|
1790
1784
|
|
1791
|
-
<li class="never" data-hits="" data-linenumber="
|
1785
|
+
<li class="never" data-hits="" data-linenumber="124">
|
1792
1786
|
|
1793
1787
|
|
1794
1788
|
<code class="ruby"></code>
|
1795
1789
|
</li>
|
1796
1790
|
|
1797
|
-
<li class="never" data-hits="" data-linenumber="
|
1791
|
+
<li class="never" data-hits="" data-linenumber="125">
|
1798
1792
|
|
1799
1793
|
|
1800
1794
|
<code class="ruby"> ##</code>
|
1801
1795
|
</li>
|
1802
1796
|
|
1803
|
-
<li class="never" data-hits="" data-linenumber="
|
1797
|
+
<li class="never" data-hits="" data-linenumber="126">
|
1804
1798
|
|
1805
1799
|
|
1806
1800
|
<code class="ruby"> # Formats a +number+ with grouped thousands using +delimiter+ (e.g., 12,324). You can</code>
|
1807
1801
|
</li>
|
1808
1802
|
|
1809
|
-
<li class="never" data-hits="" data-linenumber="
|
1803
|
+
<li class="never" data-hits="" data-linenumber="127">
|
1810
1804
|
|
1811
1805
|
|
1812
1806
|
<code class="ruby"> # customize the format in the +options+ hash.</code>
|
1813
1807
|
</li>
|
1814
1808
|
|
1815
|
-
<li class="never" data-hits="" data-linenumber="
|
1809
|
+
<li class="never" data-hits="" data-linenumber="128">
|
1816
1810
|
|
1817
1811
|
|
1818
1812
|
<code class="ruby"> #</code>
|
1819
1813
|
</li>
|
1820
1814
|
|
1821
|
-
<li class="never" data-hits="" data-linenumber="
|
1815
|
+
<li class="never" data-hits="" data-linenumber="129">
|
1822
1816
|
|
1823
1817
|
|
1824
1818
|
<code class="ruby"> # @overload with_delimiter(number, options={})</code>
|
1825
1819
|
</li>
|
1826
1820
|
|
1827
|
-
<li class="never" data-hits="" data-linenumber="
|
1821
|
+
<li class="never" data-hits="" data-linenumber="130">
|
1828
1822
|
|
1829
1823
|
|
1830
1824
|
<code class="ruby"> # @param [Fixnum, Float] number</code>
|
1831
1825
|
</li>
|
1832
1826
|
|
1833
|
-
<li class="never" data-hits="" data-linenumber="
|
1827
|
+
<li class="never" data-hits="" data-linenumber="131">
|
1834
1828
|
|
1835
1829
|
|
1836
1830
|
<code class="ruby"> # Number value to format.</code>
|
1837
1831
|
</li>
|
1838
1832
|
|
1839
|
-
<li class="never" data-hits="" data-linenumber="
|
1833
|
+
<li class="never" data-hits="" data-linenumber="132">
|
1840
1834
|
|
1841
1835
|
|
1842
1836
|
<code class="ruby"> # @param [Hash] options</code>
|
1843
1837
|
</li>
|
1844
1838
|
|
1845
|
-
<li class="never" data-hits="" data-linenumber="
|
1839
|
+
<li class="never" data-hits="" data-linenumber="133">
|
1846
1840
|
|
1847
1841
|
|
1848
1842
|
<code class="ruby"> # Options for formatter.</code>
|
1849
1843
|
</li>
|
1850
1844
|
|
1851
|
-
<li class="never" data-hits="" data-linenumber="
|
1845
|
+
<li class="never" data-hits="" data-linenumber="134">
|
1852
1846
|
|
1853
1847
|
|
1854
1848
|
<code class="ruby"> # @option options [String] :delimiter (", ")</code>
|
1855
1849
|
</li>
|
1856
1850
|
|
1857
|
-
<li class="never" data-hits="" data-linenumber="
|
1851
|
+
<li class="never" data-hits="" data-linenumber="135">
|
1858
1852
|
|
1859
1853
|
|
1860
1854
|
<code class="ruby"> # Sets the thousands delimiter.</code>
|
1861
1855
|
</li>
|
1862
1856
|
|
1863
|
-
<li class="never" data-hits="" data-linenumber="
|
1857
|
+
<li class="never" data-hits="" data-linenumber="136">
|
1864
1858
|
|
1865
1859
|
|
1866
1860
|
<code class="ruby"> # @option options [String] :separator (".")</code>
|
1867
1861
|
</li>
|
1868
1862
|
|
1869
|
-
<li class="never" data-hits="" data-linenumber="
|
1863
|
+
<li class="never" data-hits="" data-linenumber="137">
|
1870
1864
|
|
1871
1865
|
|
1872
1866
|
<code class="ruby"> # Sets the separator between the units.</code>
|
1873
1867
|
</li>
|
1874
1868
|
|
1875
|
-
<li class="never" data-hits="" data-linenumber="
|
1869
|
+
<li class="never" data-hits="" data-linenumber="138">
|
1876
1870
|
|
1877
1871
|
|
1878
1872
|
<code class="ruby"> #</code>
|
1879
1873
|
</li>
|
1880
1874
|
|
1881
|
-
<li class="never" data-hits="" data-linenumber="
|
1875
|
+
<li class="never" data-hits="" data-linenumber="139">
|
1882
1876
|
|
1883
1877
|
|
1884
1878
|
<code class="ruby"> # @return [String] The formatted representation of the number.</code>
|
1885
1879
|
</li>
|
1886
1880
|
|
1887
|
-
<li class="never" data-hits="" data-linenumber="
|
1881
|
+
<li class="never" data-hits="" data-linenumber="140">
|
1888
1882
|
|
1889
1883
|
|
1890
1884
|
<code class="ruby"> #</code>
|
1891
1885
|
</li>
|
1892
1886
|
|
1893
|
-
<li class="never" data-hits="" data-linenumber="
|
1887
|
+
<li class="never" data-hits="" data-linenumber="141">
|
1894
1888
|
|
1895
1889
|
|
1896
1890
|
<code class="ruby"> # @example</code>
|
1897
1891
|
</li>
|
1898
1892
|
|
1899
|
-
<li class="never" data-hits="" data-linenumber="
|
1893
|
+
<li class="never" data-hits="" data-linenumber="142">
|
1900
1894
|
|
1901
1895
|
|
1902
1896
|
<code class="ruby"> # with_delimiter(12345678) # => 12,345,678</code>
|
1903
1897
|
</li>
|
1904
1898
|
|
1905
|
-
<li class="never" data-hits="" data-linenumber="
|
1899
|
+
<li class="never" data-hits="" data-linenumber="143">
|
1906
1900
|
|
1907
1901
|
|
1908
1902
|
<code class="ruby"> # with_delimiter(12345678.05) # => 12,345,678.05</code>
|
1909
1903
|
</li>
|
1910
1904
|
|
1911
|
-
<li class="never" data-hits="" data-linenumber="
|
1905
|
+
<li class="never" data-hits="" data-linenumber="144">
|
1912
1906
|
|
1913
1907
|
|
1914
1908
|
<code class="ruby"> # with_delimiter(12345678, :delimiter => ".") # => 12.345.678</code>
|
1915
1909
|
</li>
|
1916
1910
|
|
1917
|
-
<li class="never" data-hits="" data-linenumber="
|
1911
|
+
<li class="never" data-hits="" data-linenumber="145">
|
1918
1912
|
|
1919
1913
|
|
1920
1914
|
<code class="ruby"> # with_delimiter(12345678, :separator => ",") # => 12,345,678</code>
|
1921
1915
|
</li>
|
1922
1916
|
|
1923
|
-
<li class="never" data-hits="" data-linenumber="
|
1917
|
+
<li class="never" data-hits="" data-linenumber="146">
|
1924
1918
|
|
1925
1919
|
|
1926
1920
|
<code class="ruby"> # with_delimiter(98765432.98, :delimiter => " ", :separator => ",")</code>
|
1927
1921
|
</li>
|
1928
1922
|
|
1929
|
-
<li class="never" data-hits="" data-linenumber="
|
1923
|
+
<li class="never" data-hits="" data-linenumber="147">
|
1930
1924
|
|
1931
1925
|
|
1932
1926
|
<code class="ruby"> # # => 98 765 432,98</code>
|
1933
1927
|
</li>
|
1934
1928
|
|
1935
|
-
<li class="never" data-hits="" data-linenumber="
|
1929
|
+
<li class="never" data-hits="" data-linenumber="148">
|
1936
1930
|
|
1937
1931
|
|
1938
1932
|
<code class="ruby"> #</code>
|
1939
1933
|
</li>
|
1940
1934
|
|
1941
|
-
<li class="covered" data-hits="1" data-linenumber="
|
1935
|
+
<li class="covered" data-hits="1" data-linenumber="149">
|
1942
1936
|
<span class="hits">1</span>
|
1943
1937
|
|
1944
1938
|
<code class="ruby"> def with_delimiter(number, args)</code>
|
1945
1939
|
</li>
|
1946
1940
|
|
1947
|
-
<li class="covered" data-hits="12" data-linenumber="
|
1941
|
+
<li class="covered" data-hits="12" data-linenumber="150">
|
1948
1942
|
<span class="hits">12</span>
|
1949
1943
|
|
1950
1944
|
<code class="ruby"> options = BB::Hash.symbolize_keys(args)</code>
|
1951
1945
|
</li>
|
1952
1946
|
|
1953
|
-
<li class="never" data-hits="" data-linenumber="
|
1947
|
+
<li class="never" data-hits="" data-linenumber="151">
|
1954
1948
|
|
1955
1949
|
|
1956
1950
|
<code class="ruby"></code>
|
1957
1951
|
</li>
|
1958
1952
|
|
1959
|
-
<li class="covered" data-hits="12" data-linenumber="
|
1953
|
+
<li class="covered" data-hits="12" data-linenumber="152">
|
1960
1954
|
<span class="hits">12</span>
|
1961
1955
|
|
1962
1956
|
<code class="ruby"> delimiter ||= (options[:delimiter] || '.')</code>
|
1963
1957
|
</li>
|
1964
1958
|
|
1965
|
-
<li class="covered" data-hits="12" data-linenumber="
|
1959
|
+
<li class="covered" data-hits="12" data-linenumber="153">
|
1966
1960
|
<span class="hits">12</span>
|
1967
1961
|
|
1968
1962
|
<code class="ruby"> separator ||= (options[:separator] || ',')</code>
|
1969
1963
|
</li>
|
1970
1964
|
|
1971
|
-
<li class="never" data-hits="" data-linenumber="
|
1965
|
+
<li class="never" data-hits="" data-linenumber="154">
|
1972
1966
|
|
1973
1967
|
|
1974
1968
|
<code class="ruby"></code>
|
1975
1969
|
</li>
|
1976
1970
|
|
1977
|
-
<li class="covered" data-hits="12" data-linenumber="
|
1971
|
+
<li class="covered" data-hits="12" data-linenumber="155">
|
1978
1972
|
<span class="hits">12</span>
|
1979
1973
|
|
1980
1974
|
<code class="ruby"> begin</code>
|
1981
1975
|
</li>
|
1982
1976
|
|
1983
|
-
<li class="covered" data-hits="12" data-linenumber="
|
1977
|
+
<li class="covered" data-hits="12" data-linenumber="156">
|
1984
1978
|
<span class="hits">12</span>
|
1985
1979
|
|
1986
1980
|
<code class="ruby"> parts = number.to_s.split('.')</code>
|
1987
1981
|
</li>
|
1988
1982
|
|
1989
|
-
<li class="covered" data-hits="12" data-linenumber="
|
1983
|
+
<li class="covered" data-hits="12" data-linenumber="157">
|
1990
1984
|
<span class="hits">12</span>
|
1991
1985
|
|
1992
1986
|
<code class="ruby"> parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimiter}")</code>
|
1993
1987
|
</li>
|
1994
1988
|
|
1995
|
-
<li class="covered" data-hits="12" data-linenumber="
|
1989
|
+
<li class="covered" data-hits="12" data-linenumber="158">
|
1996
1990
|
<span class="hits">12</span>
|
1997
1991
|
|
1998
1992
|
<code class="ruby"> parts.join(separator)</code>
|
1999
1993
|
</li>
|
2000
1994
|
|
2001
|
-
<li class="never" data-hits="" data-linenumber="
|
1995
|
+
<li class="never" data-hits="" data-linenumber="159">
|
2002
1996
|
|
2003
1997
|
|
2004
1998
|
<code class="ruby"> rescue</code>
|
2005
1999
|
</li>
|
2006
2000
|
|
2007
|
-
<li class="missed" data-hits="0" data-linenumber="
|
2001
|
+
<li class="missed" data-hits="0" data-linenumber="160">
|
2008
2002
|
|
2009
2003
|
|
2010
2004
|
<code class="ruby"> number</code>
|
2011
2005
|
</li>
|
2012
2006
|
|
2013
|
-
<li class="never" data-hits="" data-linenumber="
|
2007
|
+
<li class="never" data-hits="" data-linenumber="161">
|
2014
2008
|
|
2015
2009
|
|
2016
2010
|
<code class="ruby"> end</code>
|
2017
2011
|
</li>
|
2018
2012
|
|
2019
|
-
<li class="never" data-hits="" data-linenumber="
|
2013
|
+
<li class="never" data-hits="" data-linenumber="162">
|
2020
2014
|
|
2021
2015
|
|
2022
2016
|
<code class="ruby"> end</code>
|
2023
2017
|
</li>
|
2024
2018
|
|
2025
|
-
<li class="never" data-hits="" data-linenumber="
|
2019
|
+
<li class="never" data-hits="" data-linenumber="163">
|
2026
2020
|
|
2027
2021
|
|
2028
2022
|
<code class="ruby"> end</code>
|
2029
2023
|
</li>
|
2030
2024
|
|
2031
|
-
<li class="never" data-hits="" data-linenumber="
|
2025
|
+
<li class="never" data-hits="" data-linenumber="164">
|
2032
2026
|
|
2033
2027
|
|
2034
2028
|
<code class="ruby"> end</code>
|
2035
2029
|
</li>
|
2036
2030
|
|
2037
|
-
<li class="never" data-hits="" data-linenumber="
|
2031
|
+
<li class="never" data-hits="" data-linenumber="165">
|
2038
2032
|
|
2039
2033
|
|
2040
2034
|
<code class="ruby">end</code>
|
2041
2035
|
</li>
|
2042
2036
|
|
2043
|
-
<li class="never" data-hits="" data-linenumber="
|
2037
|
+
<li class="never" data-hits="" data-linenumber="166">
|
2044
2038
|
|
2045
2039
|
|
2046
2040
|
<code class="ruby"></code>
|