Temperature_Converter 1.0.2 → 2.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 +4 -4
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/LICENSE.txt +1 -1
- data/README.md +8 -3
- data/Rakefile +1 -1
- data/Temperature_Converter.gemspec +22 -23
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/lib/Temperature_Converter.rb +32 -18
- data/lib/Temperature_Converter/version.rb +3 -3
- metadata +21 -7
- data/LICENSE +0 -21
- data/bin/Temperature_Converter.rb +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b928ad1601532d311364f70c86c4083f7d2fd081
|
|
4
|
+
data.tar.gz: 74f4e3917267a3b644f679b7d28487bc46ca751c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad9fc66ee2591700cc578d28be76acea853da8048fbaed40ed5649906892946393362bffcc73ce5a3deea14f907e11a9b42f54a203aa3eed61bf8e8df0f03c27
|
|
7
|
+
data.tar.gz: 1107936f73cbc50a869ec27036f5a57444313575cfa5a8be5e8b9c4a53c15f8af887be3238d8ced4fb939fd8f4d90c3a52fe29971a53990665ee0a48ddedacef
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# TemperatureConverter
|
|
2
2
|
|
|
3
|
-
|
|
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/Temperature_Converter`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
4
|
|
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
|
5
6
|
|
|
6
7
|
## Installation
|
|
7
8
|
|
|
@@ -18,10 +19,14 @@ And then execute:
|
|
|
18
19
|
Or install it yourself as:
|
|
19
20
|
|
|
20
21
|
$ gem install Temperature_Converter
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
To convert from one unit to another, Call the corosponding method (Example: f_to_c for Fahrenheit to Celsius)
|
|
26
|
+
|
|
22
27
|
## Contributing
|
|
23
28
|
|
|
24
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/Temperature_Converter.
|
|
25
30
|
|
|
26
31
|
|
|
27
32
|
## License
|
data/Rakefile
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
require "bundler/gem_tasks"
|
|
2
|
-
|
|
2
|
+
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'Temperature_Converter/version'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name = "Temperature_Converter"
|
|
8
|
-
spec.version = "
|
|
9
|
-
spec.authors = ["Victor Rowello"]
|
|
10
|
-
spec.email = ["vfrowello@gmail.com"]
|
|
11
|
-
|
|
12
|
-
spec.summary = "Converts
|
|
13
|
-
spec.
|
|
14
|
-
spec.
|
|
15
|
-
spec.
|
|
16
|
-
spec.
|
|
17
|
-
spec.
|
|
18
|
-
spec.
|
|
19
|
-
spec.
|
|
20
|
-
|
|
21
|
-
spec.add_development_dependency "
|
|
22
|
-
|
|
23
|
-
end
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'Temperature_Converter/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "Temperature_Converter"
|
|
8
|
+
spec.version = "2.0.0"
|
|
9
|
+
spec.authors = ["Victor Rowello"]
|
|
10
|
+
spec.email = ["vfrowello@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = "Converts between Fahrenheit, Celsius, and Kelvin"
|
|
13
|
+
spec.homepage = "https://github.com/vrowello/Temperature_Converter.git"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
16
|
+
spec.bindir = "exe"
|
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
18
|
+
spec.require_paths = ["lib"]
|
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
|
20
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
21
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
22
|
+
end
|
data/bin/console
CHANGED
|
File without changes
|
data/bin/setup
CHANGED
|
File without changes
|
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
require "Temperature_Converter/version"
|
|
2
2
|
|
|
3
3
|
module TemperatureConverter
|
|
4
|
-
def
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
end
|
|
4
|
+
def f_to_c(x)
|
|
5
|
+
x.to_i
|
|
6
|
+
x -= 32
|
|
7
|
+
x *= (5/9)
|
|
8
|
+
end
|
|
9
9
|
|
|
10
|
-
def
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
end
|
|
10
|
+
def c_to_f(x)
|
|
11
|
+
x.to_i
|
|
12
|
+
x *= (9/5)
|
|
13
|
+
x += 32
|
|
14
|
+
end
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
def f_to_k(x)
|
|
17
|
+
x.to_i
|
|
18
|
+
x -= 32
|
|
19
|
+
x *= (5/9)
|
|
20
|
+
x += 273.15
|
|
21
|
+
end
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
x
|
|
23
|
+
def k_to_f(x)
|
|
24
|
+
x.to_i
|
|
25
|
+
x -= 273.15
|
|
26
|
+
x *= (9/5)
|
|
27
|
+
x += 32
|
|
28
|
+
end
|
|
21
29
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
end
|
|
30
|
+
def c_to_k(x)
|
|
31
|
+
x.to_i
|
|
32
|
+
x += 273.15
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def k_to_c(x)
|
|
36
|
+
x.to_i
|
|
37
|
+
x -= 273.15
|
|
38
|
+
end
|
|
39
|
+
|
|
26
40
|
end
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module TemperatureConverter
|
|
2
|
-
VERSION = "1.0
|
|
3
|
-
end
|
|
1
|
+
module TemperatureConverter
|
|
2
|
+
VERSION = "0.1.0"
|
|
3
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: Temperature_Converter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Victor Rowello
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-02-
|
|
11
|
+
date: 2016-02-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -38,7 +38,21 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '10.0'
|
|
41
|
-
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
description:
|
|
42
56
|
email:
|
|
43
57
|
- vfrowello@gmail.com
|
|
44
58
|
executables: []
|
|
@@ -46,13 +60,13 @@ extensions: []
|
|
|
46
60
|
extra_rdoc_files: []
|
|
47
61
|
files:
|
|
48
62
|
- ".gitignore"
|
|
63
|
+
- ".rspec"
|
|
64
|
+
- ".travis.yml"
|
|
49
65
|
- Gemfile
|
|
50
|
-
- LICENSE
|
|
51
66
|
- LICENSE.txt
|
|
52
67
|
- README.md
|
|
53
68
|
- Rakefile
|
|
54
69
|
- Temperature_Converter.gemspec
|
|
55
|
-
- bin/Temperature_Converter.rb
|
|
56
70
|
- bin/console
|
|
57
71
|
- bin/setup
|
|
58
72
|
- lib/Temperature_Converter.rb
|
|
@@ -77,8 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
77
91
|
version: '0'
|
|
78
92
|
requirements: []
|
|
79
93
|
rubyforge_project:
|
|
80
|
-
rubygems_version: 2.4.
|
|
94
|
+
rubygems_version: 2.4.8
|
|
81
95
|
signing_key:
|
|
82
96
|
specification_version: 4
|
|
83
|
-
summary: Converts
|
|
97
|
+
summary: Converts between Fahrenheit, Celsius, and Kelvin
|
|
84
98
|
test_files: []
|
data/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2016 Victor Rowello
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
% cat bin/Tempertaure_Converter
|
|
2
|
-
#!/usr/bin/env ruby
|
|
3
|
-
|
|
4
|
-
def fahrenheit_to_celsius(x)
|
|
5
|
-
x -= 32
|
|
6
|
-
x /= 1.8
|
|
7
|
-
puts x
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def celsius_to_fahrenheit(x)
|
|
11
|
-
x *= 1.8
|
|
12
|
-
x += 32
|
|
13
|
-
puts x
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
print "Insert Unit to Convert to: "
|
|
17
|
-
unit = gets.chomp.downcase!
|
|
18
|
-
|
|
19
|
-
print "Insert Temperature to Convert: "
|
|
20
|
-
x = gets.chomp.to_f
|
|
21
|
-
|
|
22
|
-
if unit == "celsius" then fahrenheit_to_celsius(x)
|
|
23
|
-
elsif unit == "fahrenheit" then celsius_to_fahrenheit(x)
|
|
24
|
-
else puts "Error:"
|
|
25
|
-
end
|