gem_calculating 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +13 -13
- data/CHANGELOG.md +9 -5
- data/Gemfile +5 -5
- data/Gemfile.lock +57 -57
- data/LICENSE.txt +21 -21
- data/README.md +40 -33
- data/Rakefile +8 -8
- data/gem_calculating.gemspec +36 -36
- data/lib/gem_calculating/version.rb +5 -5
- data/lib/gem_calculating.rb +44 -41
- data/sig/gem_calculating.rbs +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68f2db5877d319f0a8d3724e6c10f9f6c7ed7200134b7484b4cc27d61e0c6073
|
4
|
+
data.tar.gz: d648d2c5100c6db2516993476a9bbd356724e59a5c329eafe7d800af4915ffbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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.
|
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
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
data/gem_calculating.gemspec
CHANGED
@@ -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.
|
5
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GemCalculating
|
4
|
+
VERSION = "0.1.1"
|
5
|
+
end
|
data/lib/gem_calculating.rb
CHANGED
@@ -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
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
data/sig/gem_calculating.rbs
CHANGED
@@ -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
|