muflax 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/muflax/math.rb +18 -0
- data/muflax.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: 0bdef9e9442b7db396f82020361021f76d6156c7f8591985b81e904de902de4a
|
4
|
+
data.tar.gz: 7e231a8bcc5962157f3ef76ceb677dbb881d199d21f2b470bdc5df797a66ed1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ce6615b0f39f30f336b734f6dc8ef4f591a741f8e37ae59ddf58540f88a24c1370c92fc809e79c2cc13e5519a06725367ed866cd0e48bb08a8f2d1122f7c774
|
7
|
+
data.tar.gz: 1f0af2aa994978aa99bee3c8cac78af54636becb1d33263b035cd696587751983891bc836843217af4dec74489bfd04f5b5c03a30d82acef990119e556b0d830
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
muflax (0.5.
|
4
|
+
muflax (0.5.1)
|
5
5
|
awesome_print (~> 1)
|
6
6
|
debug_inspector (~> 0.0)
|
7
7
|
fast_blank (~> 1)
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
pry (0.12.2)
|
23
23
|
coderay (~> 1.1.0)
|
24
24
|
method_source (~> 0.9.0)
|
25
|
-
rake (12.3.
|
25
|
+
rake (12.3.3)
|
26
26
|
range_math (1.0.1)
|
27
27
|
trollop (2.1.3)
|
28
28
|
|
data/lib/muflax/math.rb
CHANGED
@@ -35,5 +35,23 @@ module Math
|
|
35
35
|
def choose k, n
|
36
36
|
Math.factorial(n) / (Math.factorial(k) * Math.factorial(n - k))
|
37
37
|
end
|
38
|
+
|
39
|
+
def mass_index coeff, mass, height, adjustment=1.0
|
40
|
+
h /= 100.0 if (50..300).include? h # cm -> m auto-correction
|
41
|
+
adjustment * (mass / (height ** coeff))
|
42
|
+
end
|
43
|
+
|
44
|
+
def mass_index_at coeff, index, height, adjustment=1.0
|
45
|
+
h /= 100.0 if (50..300).include? h # cm -> m auto-correction
|
46
|
+
index * (height ** coeff) / adjustment
|
47
|
+
end
|
48
|
+
|
49
|
+
def bmi m, h ; mass_index 2.0, m, h ; end
|
50
|
+
def bmi_adj m, h ; mass_index 2.5, m, h, 1.3 ; end
|
51
|
+
def bsi m, h ; mass_index 3.0, m, h ; end
|
52
|
+
|
53
|
+
def bmi_at i, h ; mass_index_at 2.0, i, h ; end
|
54
|
+
def bmi_adj_at i, h ; mass_index_at 2.5, i, h, 1.3 ; end
|
55
|
+
def bsi_at i, h ; mass_index_at 3.0, i, h ; end
|
38
56
|
end
|
39
57
|
end
|
data/muflax.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muflax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- muflax
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
176
|
- !ruby/object:Gem::Version
|
177
177
|
version: '0'
|
178
178
|
requirements: []
|
179
|
-
rubygems_version: 3.0.
|
179
|
+
rubygems_version: 3.0.6
|
180
180
|
signing_key:
|
181
181
|
specification_version: 4
|
182
182
|
summary: muflax standard library
|