percentage 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +8 -0
- data/lib/percentage.rb +14 -0
- data/percentage.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 017b498f1847df3570b1176c1047a0a3ab2fa394c24befbd2abdc8f4cb7e5f5e
|
4
|
+
data.tar.gz: cee72ecd3ab177c51d7784b2d596b2ec1abc4eafefaf1569a9adf32d09785bac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12621156aca237f0d6dc30d341103e4cd61caf9b2282e26aa9069651e4f6d40c71dc5be575b5a62a060bb896fb81f990f53e59c5290bb9425d124fdb583f57b6
|
7
|
+
data.tar.gz: a6cc6d0c86841a1c2fc203e5a6fd66849e0dbb9484368457d54edf4e012b1dececf26f66a1846394f016c6222cb1d510b88f4cf2536966c00b90f58335eecddc
|
data/CHANGES.md
CHANGED
data/lib/percentage.rb
CHANGED
@@ -142,6 +142,20 @@ def Percentage.change(a, b)
|
|
142
142
|
Percentage.new((b - a).to_r / a) unless a.zero?
|
143
143
|
end
|
144
144
|
|
145
|
+
class Rational
|
146
|
+
def to_percentage
|
147
|
+
Percentage(self)
|
148
|
+
end
|
149
|
+
|
150
|
+
def percent_of(n)
|
151
|
+
n * Percentage(self)
|
152
|
+
end
|
153
|
+
|
154
|
+
def as_percentage_of(n)
|
155
|
+
Percentage.new(self / n)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
145
159
|
class BigDecimal
|
146
160
|
def to_percentage
|
147
161
|
Percentage(self)
|
data/percentage.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: percentage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Craft
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
requirements: []
|
63
|
-
rubygems_version: 3.5.
|
63
|
+
rubygems_version: 3.5.11
|
64
64
|
signing_key:
|
65
65
|
specification_version: 4
|
66
66
|
summary: See description
|