calculate_bmi 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -10
- data/lib/calculate_bmi/calculate.rb +7 -3
- data/lib/calculate_bmi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b3a47cbe700eb49fa959bf927041ed081974970
|
4
|
+
data.tar.gz: 1cd1dadc23f5ae730c69fd9016143a1d33042238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a03f0847ba3950ae52271936a4cb7f94d474e9c8c7d31ea09071c8a7005517b9e45644d128cc674891d0c2c8b56113f8f0f1ef9e8fcedf7490cc659a1fb8731
|
7
|
+
data.tar.gz: ea5854ad97e742a5c37a32b6005da41a7789cbb10a248054817c53a62623c5f257617456b60c8330e54e9ae44e6d364516d59c2dbb410940fe6999af2b230ef5
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/calculate_bmi.svg)](https://badge.fury.io/rb/calculate_bmi)
|
2
|
+
[![Build Status](https://travis-ci.org/mattrothstein/calc-bmi.svg?branch=master)](https://travis-ci.org/mattrothstein/calc-bmi)
|
1
3
|
# CalculateBmi
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
5
|
+
CalculateBMI is used to calculate the body mass index based on height and weight.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,13 +22,7 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
Use the `
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
25
|
+
Use the `CalculateBmi::Calculate.us_calc([feet,inches], weight)` please use feet, inches and pounds (if height is 6'0" please enter height as `[6,0]`).
|
32
26
|
|
33
27
|
## Contributing
|
34
28
|
|
@@ -1,8 +1,12 @@
|
|
1
1
|
module CalculateBmi
|
2
2
|
class Calculate
|
3
|
-
def self.
|
4
|
-
|
5
|
-
|
3
|
+
def self.us_calc(height, weight)
|
4
|
+
weight_in_kg = weight * 0.453592
|
5
|
+
feet = height[0] * 12
|
6
|
+
height = feet + height[1]
|
7
|
+
height_in_m = height * 0.0254
|
8
|
+
bmi = (weight_in_kg / (height_in_m * height_in_m)).round(1)
|
9
|
+
return bmi
|
6
10
|
end
|
7
11
|
end
|
8
12
|
end
|