gem_calculating 0.1.0 → 0.1.2

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: 15b869f17f53dbb7cf120f7639d4008ffa12e0c06330d2dc89833259be1a3a8f
4
+ data.tar.gz: 31fa978cab89e5758fd93323319aca698723c6213dcfe7479e2858126cbeb400
5
5
  SHA512:
6
- metadata.gz: c2efd85a1c2c2180d709be747d70785b5ab8a499b7394abeabdcb78c33c28c7f50cefc1a85fc25967bc2bbe88553a16d2760d65fd2760077b44eb171688f5122
7
- data.tar.gz: 1677214ddbd7caa18ed8720c91b35c53d5259d1a48becacf610456f92ac6aa004b8e1ed1e027461a8eb7b81ac60ebf6c44ac15152e4c9c93661a3e71fba8b354
6
+ metadata.gz: 886c7b3098c553858cc42992990c6fab6767563f23aeaad60e8c81998a65bf68189afaa0c86098ea7b16486deea2affc52cd6d001a3ddb551c2c2f5b0a92163b
7
+ data.tar.gz: f90b26b9f5894b6cb71357cea988c262a54150361af2f38e87c661c9fd6663bd18aaf2b86dac3b8b079e4839158a033f31afd737a29b260fd14feab20b212faa
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.2)
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.2"
5
+ end
@@ -1,41 +1,49 @@
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
+ require_relative "gem_calculating/version"
3
+
4
+ module Calculate
5
+ # Adds two numbers
6
+ def self.add(num1, num2)
7
+ if validate_numbers(num1, num2) == true
8
+ return puts "Numbers is not valid"
9
+ end
10
+ num1 + num2
11
+ rescue StandardError
12
+ nil
13
+ end
14
+ # Subtract two numbers
15
+ def self.subtract(num1, num2)
16
+ if validate_numbers(num1, num2) == true
17
+ return puts "Numbers is not valid"
18
+ end
19
+ num1 - num2
20
+ rescue StandardError
21
+ nil
22
+ end
23
+ # Multiply two numbers
24
+ def self.multiply(num1, num2)
25
+ if validate_numbers(num1, num2) == true
26
+ return puts "Numbers is not valid"
27
+ end
28
+ num1 * num2
29
+ rescue StandardError
30
+ nil
31
+ end
32
+ # Divide two numbers
33
+ def self.divide(num1, num2)
34
+ if validate_numbers(num1, num2) == true
35
+ return puts "Numbers is not valid"
36
+ end
37
+ num1 / num2
38
+ rescue StandardError
39
+ nil
40
+ end
41
+
42
+ private_class_method def self.validate_numbers(num1, num2)
43
+ num1.is_a?(String) or num2.is_a?(String)
44
+ end
45
+
46
+
47
+ class Error < StandardError; end
48
+ # Your code goes here...
49
+ 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,14 +1,14 @@
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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleksii Ostafiichuk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-19 00:00:00.000000000 Z
11
+ date: 2022-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubygems_version: 3.2.3
82
+ rubygems_version: 3.2.33
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Simple calculator gem that can add, subtract, multiply, and divide.