temp_converter_gem 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 266572d46059e0a50ed82a77fc8530cfca155ae46ba84d9fe2f11cda239905f0
4
+ data.tar.gz: 8b0c7f3f2b587dfe9ecf57fce875b0dc8c6cbe8355173c43e0d91b2211a83aa5
5
+ SHA512:
6
+ metadata.gz: 52476d3f854af433e826f1b68bb7feab92aefeb3143f5677ac57ec7860754e2d9c0d209a3a2e2998298ee6624ce23e28273929c4459908516938dcd0eaf5fdad
7
+ data.tar.gz: ed4a3a55322843fd746ee8a2d61a259c5815a378cf33a958bd41e2bd202519f1853f3e26db24976902488e575e5a89de6e3b4a40e9a794fd640641d078a9f237
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in temp_converter_gem.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # TempConverterGem
2
+
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/temp_converter_gem`. 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
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ $ bundle add temp_converter_gem
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install temp_converter_gem
16
+
17
+ ## Usage
18
+
19
+ TODO: Write usage instructions here
20
+
21
+ ## Development
22
+
23
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+
25
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/temp_converter_gem.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TempConverterGem
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "temp_converter_gem/version"
4
+
5
+ module TempConverterGem
6
+ class Convert
7
+ class << self
8
+ def to_celsius(scale, temp)
9
+ case scale
10
+ when :fahrenheit, :f
11
+ return (temp - 32) / 1.8
12
+ when :kelvin, :k
13
+ return (temp - 273.15)
14
+ else
15
+ raise ArgumentError, "Invalid scale"
16
+ end
17
+ end
18
+
19
+ def to_fahrenheit(scale, temp)
20
+ case scale
21
+ when :celsius, :c
22
+ return (temp * 1.8) + 32
23
+ when :kelvin, :k
24
+ return ((temp - 273.15) * 1.8) + 32
25
+ else
26
+ raise ArgumentError, "Invalid scale"
27
+ end
28
+ end
29
+
30
+ def to_kelvin(scale, temp)
31
+ case scale
32
+ when :fahrenheit, :f
33
+ return temp + 273.15
34
+ when :celsius, :c
35
+ return ((temp - 32) / 1.8) + 273.15
36
+ else
37
+ raise ArgumentError, "Invalid scale"
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,4 @@
1
+ module TempConverterGem
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: temp_converter_gem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - MatusSN
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-04-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: convert temperatures simply and quickly!
14
+ email:
15
+ - matussn.erb@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - Gemfile
21
+ - README.md
22
+ - Rakefile
23
+ - lib/temp_converter_gem.rb
24
+ - lib/temp_converter_gem/version.rb
25
+ - sig/temp_converter_gem.rbs
26
+ homepage: https://github.com/MatusSN/temp_converter_gem
27
+ licenses: []
28
+ metadata:
29
+ homepage_uri: https://github.com/MatusSN/temp_converter_gem
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: 2.6.0
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubygems_version: 3.3.26
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: convert temperatures
49
+ test_files: []