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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9b07c2ad54ab3fb8c72ca2fb0f5b7e329e9f0d22c66e935a53340079fdab7e2
4
- data.tar.gz: d0eeaf16563dfc127cacd0f5726967c4934442af1861cc4b0b25ca9e9d745b1a
3
+ metadata.gz: 0bdef9e9442b7db396f82020361021f76d6156c7f8591985b81e904de902de4a
4
+ data.tar.gz: 7e231a8bcc5962157f3ef76ceb677dbb881d199d21f2b470bdc5df797a66ed1e
5
5
  SHA512:
6
- metadata.gz: 1ac6a3aaad1add82d5346a48d06c6a1293d23007d6308a4d9a75c0ad5450394cad6fa8d94c5115768a5582d25a3cb460de0accc06c62944978a16de22384ae6a
7
- data.tar.gz: 8af8fc0380a982d6f7a31d6524d1670b5c612e3948385a6b1c0fc0b662480b36069212e45fffec409053ad8e47ff55f9e639cbe60a735f78bd5f1e82fe14d2e2
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.0)
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.2)
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "muflax"
3
- s.version = "0.5.0"
3
+ s.version = "0.5.1"
4
4
 
5
5
  s.authors = ["muflax"]
6
6
  s.summary = "muflax standard library"
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.0
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-06-28 00:00:00.000000000 Z
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.4
179
+ rubygems_version: 3.0.6
180
180
  signing_key:
181
181
  specification_version: 4
182
182
  summary: muflax standard library