gem_calculating 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a4d0ae2058acf138367d660cfa6fb02ddd070e68af929b29a5db4d116a6eea9
4
- data.tar.gz: d1e304b714780a7dbc4001ac0fe485984e16d946a02241d56faa00fb34ded4c2
3
+ metadata.gz: 68f2db5877d319f0a8d3724e6c10f9f6c7ed7200134b7484b4cc27d61e0c6073
4
+ data.tar.gz: d648d2c5100c6db2516993476a9bbd356724e59a5c329eafe7d800af4915ffbb
5
5
  SHA512:
6
- metadata.gz: c2efd85a1c2c2180d709be747d70785b5ab8a499b7394abeabdcb78c33c28c7f50cefc1a85fc25967bc2bbe88553a16d2760d65fd2760077b44eb171688f5122
7
- data.tar.gz: 1677214ddbd7caa18ed8720c91b35c53d5259d1a48becacf610456f92ac6aa004b8e1ed1e027461a8eb7b81ac60ebf6c44ac15152e4c9c93661a3e71fba8b354
6
+ metadata.gz: 725e4ba2fd4dc07f25c26cbaea3b3e9e582e4d2101bfc6ae5c1400af3f93dc5544d3cd342f30c334f1cb40be31eada64688563069b7edfddfc664bd8377b3b98
7
+ data.tar.gz: bea625510ec8c6267d6ccd87a1bc41370d0e755a76bb4007d851637bf63cf71e3773e9de998f139d2d9a58b68323a3e89cfa7e92a66335f0a83b2349bc7306f5
data/.rubocop.yml CHANGED
@@ -1,13 +1,13 @@
1
- AllCops:
2
- TargetRubyVersion: 2.6
3
-
4
- Style/StringLiterals:
5
- Enabled: true
6
- EnforcedStyle: double_quotes
7
-
8
- Style/StringLiteralsInInterpolation:
9
- Enabled: true
10
- EnforcedStyle: double_quotes
11
-
12
- Layout/LineLength:
13
- Max: 120
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
- ## [Unreleased]
2
-
3
- ## [0.1.0] - 2022-10-19
4
-
5
- - Initial release
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-10-19
4
+
5
+ - Initial release
6
+
7
+ ## [0.1.1] - 2022-10-19
8
+
9
+ - Add tests
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- gem "rake", "~> 13.0"
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "rake", "~> 13.0"
6
6
  gem "rubocop", "~> 1.21"
data/Gemfile.lock CHANGED
@@ -1,57 +1,57 @@
1
- PATH
2
- remote: .
3
- specs:
4
- gem_calculating (0.1.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- ast (2.4.2)
10
- diff-lcs (1.5.0)
11
- json (2.6.2)
12
- parallel (1.22.1)
13
- parser (3.1.2.1)
14
- ast (~> 2.4.1)
15
- rainbow (3.1.1)
16
- rake (13.0.6)
17
- regexp_parser (2.6.0)
18
- rexml (3.2.5)
19
- rspec (3.11.0)
20
- rspec-core (~> 3.11.0)
21
- rspec-expectations (~> 3.11.0)
22
- rspec-mocks (~> 3.11.0)
23
- rspec-core (3.11.0)
24
- rspec-support (~> 3.11.0)
25
- rspec-expectations (3.11.1)
26
- diff-lcs (>= 1.2.0, < 2.0)
27
- rspec-support (~> 3.11.0)
28
- rspec-mocks (3.11.1)
29
- diff-lcs (>= 1.2.0, < 2.0)
30
- rspec-support (~> 3.11.0)
31
- rspec-support (3.11.1)
32
- rubocop (1.36.0)
33
- json (~> 2.3)
34
- parallel (~> 1.10)
35
- parser (>= 3.1.2.1)
36
- rainbow (>= 2.2.2, < 4.0)
37
- regexp_parser (>= 1.8, < 3.0)
38
- rexml (>= 3.2.5, < 4.0)
39
- rubocop-ast (>= 1.20.1, < 2.0)
40
- ruby-progressbar (~> 1.7)
41
- unicode-display_width (>= 1.4.0, < 3.0)
42
- rubocop-ast (1.22.0)
43
- parser (>= 3.1.1.0)
44
- ruby-progressbar (1.11.0)
45
- unicode-display_width (2.3.0)
46
-
47
- PLATFORMS
48
- x86_64-linux
49
-
50
- DEPENDENCIES
51
- gem_calculating!
52
- rake (~> 13.0)
53
- rspec (~> 3.11.0)
54
- rubocop (~> 1.21)
55
-
56
- BUNDLED WITH
57
- 2.3.24
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gem_calculating (0.1.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ diff-lcs (1.5.0)
11
+ json (2.6.2)
12
+ parallel (1.22.1)
13
+ parser (3.1.2.1)
14
+ ast (~> 2.4.1)
15
+ rainbow (3.1.1)
16
+ rake (13.0.6)
17
+ regexp_parser (2.6.0)
18
+ rexml (3.2.5)
19
+ rspec (3.11.0)
20
+ rspec-core (~> 3.11.0)
21
+ rspec-expectations (~> 3.11.0)
22
+ rspec-mocks (~> 3.11.0)
23
+ rspec-core (3.11.0)
24
+ rspec-support (~> 3.11.0)
25
+ rspec-expectations (3.11.1)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.11.0)
28
+ rspec-mocks (3.11.1)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.11.0)
31
+ rspec-support (3.11.1)
32
+ rubocop (1.36.0)
33
+ json (~> 2.3)
34
+ parallel (~> 1.10)
35
+ parser (>= 3.1.2.1)
36
+ rainbow (>= 2.2.2, < 4.0)
37
+ regexp_parser (>= 1.8, < 3.0)
38
+ rexml (>= 3.2.5, < 4.0)
39
+ rubocop-ast (>= 1.20.1, < 2.0)
40
+ ruby-progressbar (~> 1.7)
41
+ unicode-display_width (>= 1.4.0, < 3.0)
42
+ rubocop-ast (1.22.0)
43
+ parser (>= 3.1.1.0)
44
+ ruby-progressbar (1.11.0)
45
+ unicode-display_width (2.3.0)
46
+
47
+ PLATFORMS
48
+ x86_64-linux
49
+
50
+ DEPENDENCIES
51
+ gem_calculating!
52
+ rake (~> 13.0)
53
+ rspec (~> 3.11.0)
54
+ rubocop (~> 1.21)
55
+
56
+ BUNDLED WITH
57
+ 2.3.24
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2022 Oleksii Ostafiichuk
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
13
- all 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
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Oleksii Ostafiichuk
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,33 +1,40 @@
1
- # GemCalculating
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/gem_calculating`. 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 gem_calculating
12
-
13
- If bundler is not being used to manage dependencies, install the gem by executing:
14
-
15
- $ gem install gem_calculating
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]/gem_calculating.
30
-
31
- ## License
32
-
33
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
1
+ # GemCalculating
2
+
3
+ Basic calculator gem. Can add, subtract, multiply, and divide.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ $ bundle add gem_calculating
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ $ gem install gem_calculating
14
+
15
+ ## Usage
16
+
17
+ First you need to require the gem:
18
+
19
+ require 'gem_calculating'
20
+
21
+ Then you can use the gem:
22
+
23
+ GemCalculating::Calculator.add(2, 3)# => 5
24
+ GemCalculating::Calculator.subtract(3, 2)# => 1
25
+ GemCalculating::Calculator.multiply(2, 3)# => 6
26
+ GemCalculating::Calculator.divide(4, 2)# => 2
27
+
28
+ ## Development
29
+
30
+ 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.
31
+
32
+ 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).
33
+
34
+ ## Contributing
35
+
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/OstafiichukO/gem_calculating.
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rubocop/rake_task"
5
-
6
- RuboCop::RakeTask.new
7
-
8
- task default: :rubocop
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
@@ -1,36 +1,36 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/gem_calculating/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "gem_calculating"
7
- spec.version = GemCalculating::VERSION
8
- spec.authors = ["Oleksii Ostafiichuk"]
9
- spec.email = ["issimo333@gmail.com"]
10
-
11
- spec.summary = "Simple calculator gem that can add, subtract, multiply, and divide."
12
- spec.description = "Calculator gem that can add, subtract, multiply, and divide"
13
- spec.homepage = "https://github.com/OstafiichukO/gem_calculating"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.6.0"
16
-
17
- spec.metadata["allowed_push_host"] = "https://rubygems.org/"
18
-
19
- spec.metadata["homepage_uri"] = spec.homepage
20
- spec.metadata["source_code_uri"] = "https://github.com/OstafiichukO/gem_calculating"
21
- spec.metadata["changelog_uri"] = "https://github.com/OstafiichukO/gem_calculating/blob/main/CHANGELOG.md"
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
- spec.add_development_dependency 'rspec', '~> 3.11.0'
35
- spec.add_development_dependency 'rubocop', '~> 1.21'
36
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/gem_calculating/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "gem_calculating"
7
+ spec.version = GemCalculating::VERSION
8
+ spec.authors = ["Oleksii Ostafiichuk"]
9
+ spec.email = ["issimo333@gmail.com"]
10
+
11
+ spec.summary = "Simple calculator gem that can add, subtract, multiply, and divide."
12
+ spec.description = "Calculator gem that can add, subtract, multiply, and divide"
13
+ spec.homepage = "https://github.com/OstafiichukO/gem_calculating"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/OstafiichukO/gem_calculating"
21
+ spec.metadata["changelog_uri"] = "https://github.com/OstafiichukO/gem_calculating/blob/main/CHANGELOG.md"
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
+ spec.add_development_dependency 'rspec', '~> 3.11.0'
35
+ spec.add_development_dependency 'rubocop', '~> 1.21'
36
+ end
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
- module GemCalculating
4
- VERSION = "0.1.0"
5
- end
1
+ # frozen_string_literal: true
2
+
3
+ module GemCalculating
4
+ VERSION = "0.1.1"
5
+ end
@@ -1,41 +1,44 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "gem_calculating/version"
4
-
5
- # Calculator gem
6
- module GemCalculating
7
- # Class for calculating
8
- class Calculator
9
- # Adds two numbers
10
- def self.add(num1, num2)
11
- num1 + num2
12
- rescue StandardError
13
- nil
14
- end
15
- # Subtract two numbers
16
- def self.subtract(num1, num2)
17
- num1 - num2
18
- rescue StandardError
19
- nil
20
- end
21
- #Multiply two numbers
22
- def self.multiply(num1, num2)
23
- num1 * num2
24
- rescue StandardError
25
- nil
26
- end
27
- #Divide two numbers
28
- def self.divide(num1, num2)
29
- num1 / num2
30
- rescue StandardError
31
- nil
32
- end
33
-
34
- private_class_method def self.validate_numbers(num1, num2)
35
- num1.is_a?(String) or num2.is_a?(String)
36
- end
37
- end
38
-
39
- # class Error < StandardError; end
40
- # Your code goes here...
41
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "gem_calculating/version"
4
+
5
+ # Calculator gem
6
+ module GemCalculating
7
+ # Class for calculating
8
+ class Calculator
9
+ # Adds two numbers
10
+ def self.add(num1, num2)
11
+ if validate_numbers(num1, num2) == true
12
+ return puts "Numbers is not valid"
13
+ end
14
+ num1 + num2
15
+ rescue StandardError
16
+ nil
17
+ end
18
+ # Subtract two numbers
19
+ def self.subtract(num1, num2)
20
+ num1 - num2
21
+ rescue StandardError
22
+ nil
23
+ end
24
+ # Multiply two numbers
25
+ def self.multiply(num1, num2)
26
+ num1 * num2
27
+ rescue StandardError
28
+ nil
29
+ end
30
+ # Divide two numbers
31
+ def self.divide(num1, num2)
32
+ num1 / num2
33
+ rescue StandardError
34
+ nil
35
+ end
36
+
37
+ private_class_method def self.validate_numbers(num1, num2)
38
+ num1.is_a?(String) or num2.is_a?(String)
39
+ end
40
+ end
41
+
42
+ # class Error < StandardError; end
43
+ # Your code goes here...
44
+ end
@@ -1,4 +1,4 @@
1
- module GemCalculating
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end
1
+ module GemCalculating
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_calculating
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
  - Oleksii Ostafiichuk