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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 261854c7a94165b80da5bdf7a36541be5dbad5f7
4
- data.tar.gz: a929db8eda6aed8a6ab05ca4d01a2ea460288c3f
3
+ metadata.gz: 5b3a47cbe700eb49fa959bf927041ed081974970
4
+ data.tar.gz: 1cd1dadc23f5ae730c69fd9016143a1d33042238
5
5
  SHA512:
6
- metadata.gz: 1ec28d9d19f2149a66a36050a7ab1d9e615cb17c7662ce2260141c3171b6fde9dfcaee22b547f86e5c931473ea28561f8373aab4dbc56124ace5cab3a0ed2654
7
- data.tar.gz: 2eb72d77290b51084f474b9b828f13e796f7718bb1c9e5f93d2fe9f006420885fe30dcd3587fdc257af99b80b15ef5115b5001b811ade965674592c233785287
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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/calculate_bmi`. To experiment with that code, run `bin/console` for an interactive prompt.
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 `calculate_bmi([feet,inches], weight)` please use feet, inches and pounds.
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.calc(int)
4
- #TODO: process `int`
5
- int
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
@@ -1,3 +1,3 @@
1
1
  module CalculateBmi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calculate_bmi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Rothstein