convert_unit_tools 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/convert.rb +48 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ece6f7d22ce6594e9bbdc4a3061f2b6b26787ffaf09a68f326b64bfb2aeb2f9e
|
4
|
+
data.tar.gz: 72060b79f900712bfcf3fc932836e7a737228f0d6c3ed3eae707afbf02a75837
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4dbbc00fd953c11cc0d12f1ade249ad9b85cfd5e1dce891686711b8dda22a4b57c1ba2c10eb03e6bb8c1af1d1e502bcd705fdc56d7317457397081f582c158ad
|
7
|
+
data.tar.gz: db3a0bacdbed14806d22e6c9d7360a0f69e9291bf5201a85c3b325ae76087a2c0f9b1ead66797a7ef9496e7df0b1b6831b5a9644b272279ec5cff5e67163b7a6
|
data/lib/convert.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
class Convert
|
2
|
+
def convert_temp(inputvalue, from_unit, to_unit)
|
3
|
+
#make sure vars are the right data type
|
4
|
+
inputvalue = inputvalue.to_f
|
5
|
+
from_unit = from_unit.to_s
|
6
|
+
to_unit = to_unit.to_s
|
7
|
+
|
8
|
+
if from_unit =="Celsius" && to_unit == "Farenheit"
|
9
|
+
return result = (inputvalue * 1.8) + 32
|
10
|
+
elsif from_unit == "Farenheit" && to_unit == "Celsius"
|
11
|
+
return result = (inputvalue - 32) * 5/9
|
12
|
+
else
|
13
|
+
return "Error matching case for temp conversion"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def convert_weight(inputvalue, from_unit, to_unit)
|
18
|
+
if from_unit =="KG" && to_unit == "Pounds"
|
19
|
+
return result = (inputvalue * 2.20)
|
20
|
+
elsif from_unit == "Pounds" && to_unit == "KG"
|
21
|
+
return result = (inputvalue *0.453)
|
22
|
+
else
|
23
|
+
return "Error matching case for weight conversion"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def convert_area(inputvalue, from_unit, to_unit)
|
28
|
+
if from_unit =="acre" && to_unit == "hectare"
|
29
|
+
return result = (inputvalue /2.471)
|
30
|
+
elsif from_unit == "hectare" && to_unit == "acre"
|
31
|
+
return result = (inputvalue *2.471)
|
32
|
+
else
|
33
|
+
return "Error matching case for weight conversion"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
def convert_speed(inputvalue, from_unit, to_unit)
|
39
|
+
if from_unit =="MPH" && to_unit == "KPH"
|
40
|
+
return result = (inputvalue *1.609)
|
41
|
+
elsif from_unit == "KPH" && to_unit == "MPH"
|
42
|
+
return result = (inputvalue /1.609)
|
43
|
+
else
|
44
|
+
return "Error matching case for area conversion"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: convert_unit_tools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- x18119859
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-03-31 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Area conversion from Hectares to acres, measurements from inches to cm.
|
14
|
+
Weight from pounds to KG. All conversions reversible
|
15
|
+
email: notprovided@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/convert.rb
|
21
|
+
homepage: https://rubygems.org/gems/example
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata:
|
25
|
+
source_code_uri: https://github.com/DylanBrennan92
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubygems_version: 3.3.26
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Offers basic unit conversions!
|
45
|
+
test_files: []
|