percentage 2.1.0 → 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 +12 -0
- data/lib/percentage.rb +14 -0
- data/percentage.gemspec +2 -1
- metadata +18 -4
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
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'percentage'
|
3
|
-
s.version = '2.
|
3
|
+
s.version = '2.2.0'
|
4
4
|
s.license = 'LGPL-3.0'
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
6
|
s.authors = ['Tim Craft']
|
@@ -17,4 +17,5 @@ Gem::Specification.new do |s|
|
|
17
17
|
'bug_tracker_uri' => 'https://github.com/readysteady/percentage/issues',
|
18
18
|
'changelog_uri' => 'https://github.com/readysteady/percentage/blob/main/CHANGES.md'
|
19
19
|
}
|
20
|
+
s.add_runtime_dependency 'bigdecimal'
|
20
21
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
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-
|
12
|
-
dependencies:
|
11
|
+
date: 2024-10-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bigdecimal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description: Ruby gem for working with percentages
|
14
28
|
email:
|
15
29
|
- mail@timcraft.com
|
@@ -46,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
62
|
requirements: []
|
49
|
-
rubygems_version: 3.
|
63
|
+
rubygems_version: 3.5.11
|
50
64
|
signing_key:
|
51
65
|
specification_version: 4
|
52
66
|
summary: See description
|