calc_ruby_test_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: 11e505136d4ec16df324d4600863b95cf05c876ab9f555d0491a6d25e5298373
4
+ data.tar.gz: b48c77fa095fe0456d340718b8db42753b18eeab23f2ea1915aecb773c4bbbb4
5
+ SHA512:
6
+ metadata.gz: 42383fe5f022a230200106930675771999ca3fd694911dc661e383a29ed1df8317a80157a6b49f32463c4f8ec65d0e542f5cc6762160b96afc93a55d302e7729
7
+ data.tar.gz: c9b98ab89f298a05601a3002062764435965487f53ab77c9f22c86b081fd78120ce62e49685165ef5dda9db014192d982d054e1744c9f48509b95080f3bc9d3b
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 calc_ruby_test_gem.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # CalcRubyTestGem
2
+
3
+ This is a Ruby gem basic calculator. It can do basic mathematical operations like addition, subtraction, multiplication, and division mathematical calculations.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ $ bundle add calc_ruby_test_gem
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ $ gem install calc_ruby_test_gem
14
+
15
+ ## Usage
16
+
17
+ Please enter your example with space between each element (2 * 5).
18
+
19
+ ## Development
20
+
21
+ 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.
22
+
23
+ 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).
24
+
25
+ ## Contributing
26
+
27
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/calc_ruby_test_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,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/calc_ruby_test_gem/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "calc_ruby_test_gem"
7
+ spec.version = CalcRubyTestGem::VERSION
8
+ spec.authors = ["Alex"]
9
+ spec.email = ["alex.phazz@gmail.com"]
10
+
11
+ spec.summary = "Basic calculator."
12
+ spec.description = "Basic calculator with addition, subtraction, multiplication and division mathematical calculations."
13
+ spec.homepage = "https://github.com/PhazZzyo/calc_ruby_test_gem"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/PhazZzyo/calc_ruby_test_gem"
21
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(__dir__) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
+ end
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ # spec.add_dependency "example-gem", "~> 1.0"
36
+
37
+ # For more information and examples about making a new gem, check out our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CalcRubyTestGem
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "calc_ruby_test_gem/version"
4
+
5
+ module CalcRubyTestGem
6
+ class Error < StandardError; end
7
+
8
+ puts "Please enter your example with space between each element: "
9
+
10
+ example = gets.to_s.split
11
+
12
+ a = example[0].to_f
13
+ b = example[1].to_s
14
+ c = example[2].to_f
15
+
16
+ case b
17
+ when "+"
18
+ puts "The result is: #{a + c}"
19
+
20
+ when "-"
21
+ puts "The result is: #{a - c}"
22
+
23
+ when "*"
24
+ puts "The result is: #{a * c}"
25
+
26
+ when "/"
27
+ puts "The result is: #{a / c}"
28
+ else
29
+ puts "Sorry, you entered an invalid operator, only +, -, *, / are allowed!"
30
+ end
31
+ end
@@ -0,0 +1,4 @@
1
+ module CalcRubyTestGem
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: calc_ruby_test_gem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-10-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Basic calculator with addition, subtraction, multiplication and division
14
+ mathematical calculations.
15
+ email:
16
+ - alex.phazz@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - Gemfile
22
+ - README.md
23
+ - Rakefile
24
+ - calc_ruby_test_gem.gemspec
25
+ - lib/calc_ruby_test_gem.rb
26
+ - lib/calc_ruby_test_gem/version.rb
27
+ - sig/calc_ruby_test_gem.rbs
28
+ homepage: https://github.com/PhazZzyo/calc_ruby_test_gem
29
+ licenses:
30
+ - MIT
31
+ metadata:
32
+ homepage_uri: https://github.com/PhazZzyo/calc_ruby_test_gem
33
+ source_code_uri: https://github.com/PhazZzyo/calc_ruby_test_gem
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.6.0
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubygems_version: 3.2.3
50
+ signing_key:
51
+ specification_version: 4
52
+ summary: Basic calculator.
53
+ test_files: []