birthgem 1.0.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: '0519e8a0a3097d9cf18e5c12ac95bda0a36c17b1c21e2f5ef99af99238376f7f'
4
+ data.tar.gz: 91cfb4fa51fa56bcaad4a80163bd07d07e6ad99465ac461ad9afea1814a80cf9
5
+ SHA512:
6
+ metadata.gz: 3b0ac3f88f02899e256029c03a55a677d952bfd706fa2f17208e3c4c74b2fb35f9398b49c87edb41b3b12cf2c57d8562b99988ba7c98ac2b91f1290618e0c94d
7
+ data.tar.gz: 6012a9a5cb77a0a66cf6bc75ce00eafcbf2d381be0216542d03a76c9e6a44a37653db0a790e17f8c505db92c360e6631ed105337c827d415e2a555e69b4d037e
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,3 @@
1
+ inherit_gem:
2
+ rubocop-fjord:
3
+ - "config/rubocop.yml"
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in birthgem.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 13.0'
9
+
10
+ gem 'rspec', '~> 3.0'
11
+
12
+ gem 'rubocop', '~> 1.21'
13
+
14
+ group :development do
15
+ gem 'rubocop-fjord', require: false
16
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ birthgem (1.0.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ diff-lcs (1.5.0)
11
+ parallel (1.21.0)
12
+ parser (3.1.0.0)
13
+ ast (~> 2.4.1)
14
+ rainbow (3.1.1)
15
+ rake (13.0.6)
16
+ regexp_parser (2.2.0)
17
+ rexml (3.2.5)
18
+ rspec (3.10.0)
19
+ rspec-core (~> 3.10.0)
20
+ rspec-expectations (~> 3.10.0)
21
+ rspec-mocks (~> 3.10.0)
22
+ rspec-core (3.10.1)
23
+ rspec-support (~> 3.10.0)
24
+ rspec-expectations (3.10.2)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.10.0)
27
+ rspec-mocks (3.10.2)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.10.0)
30
+ rspec-support (3.10.3)
31
+ rubocop (1.24.1)
32
+ parallel (~> 1.10)
33
+ parser (>= 3.0.0.0)
34
+ rainbow (>= 2.2.2, < 4.0)
35
+ regexp_parser (>= 1.8, < 3.0)
36
+ rexml
37
+ rubocop-ast (>= 1.15.1, < 2.0)
38
+ ruby-progressbar (~> 1.7)
39
+ unicode-display_width (>= 1.4.0, < 3.0)
40
+ rubocop-ast (1.15.1)
41
+ parser (>= 3.0.1.1)
42
+ rubocop-fjord (0.2.0)
43
+ rubocop (>= 1.0)
44
+ rubocop-performance
45
+ rubocop-performance (1.13.2)
46
+ rubocop (>= 1.7.0, < 2.0)
47
+ rubocop-ast (>= 0.4.0)
48
+ ruby-progressbar (1.11.0)
49
+ unicode-display_width (2.1.0)
50
+
51
+ PLATFORMS
52
+ x86_64-darwin-21
53
+ x86_64-linux
54
+
55
+ DEPENDENCIES
56
+ birthgem!
57
+ rake (~> 13.0)
58
+ rspec (~> 3.0)
59
+ rubocop (~> 1.21)
60
+ rubocop-fjord
61
+
62
+ BUNDLED WITH
63
+ 2.3.5
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 kaisumi
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 ADDED
@@ -0,0 +1,44 @@
1
+ # Birthgem
2
+
3
+ This module lets you know the birstone(s) for an entered birthday.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'birthgem'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install birthgem
20
+
21
+ ## Usage
22
+
23
+ ````
24
+ Birthgem.stone('2022-01-18')
25
+ # => ['Garnet']
26
+
27
+ Birthgem.stone(10)
28
+ # => ['Opal', 'Tourmaline']
29
+
30
+ require 'date'
31
+ birthday = Date.new(1993, 2, 24)
32
+ Birthgem.stone(birthday)
33
+ # => ['Amethyst']
34
+ ````
35
+ ## Contributing
36
+ 1. Fork it ( https://github.com/kaisumi/birthgem/fork )
37
+ 2. Create your feature branch (git checkout -b my-new-feature)
38
+ 3. Commit your changes (git commit -am 'Add some feature')
39
+ 4. Push to the branch (git push origin my-new-feature)
40
+ 5. Create a new Pull Request
41
+
42
+ ## License
43
+
44
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Birthgem
4
+ VERSION = '1.0.0'
5
+ end
data/lib/birthgem.rb ADDED
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'birthgem/version'
4
+ require 'date'
5
+
6
+ ##
7
+ # This module lets you know the birstone(s) for an entered birthday.
8
+
9
+ module Birthgem
10
+ ##
11
+ # The birthstones are selected according to [International Gem Society](https://www.gemsociety.org/article/birthstone-chart/).
12
+
13
+ STONE_BY_MONTH = {
14
+ 1 => %w[Garnet],
15
+ 2 => %w[Amethyst],
16
+ 3 => %w[Aquamarine],
17
+ 4 => %w[Diamond],
18
+ 5 => %w[Emerald],
19
+ 6 => %w[Pearl Alexandrite],
20
+ 7 => %w[Ruby],
21
+ 8 => %w[Peridot],
22
+ 9 => %w[Sapphire],
23
+ 10 => %w[Opal Tourmaline],
24
+ 11 => %w[Citrine],
25
+ 12 => ['Blue Topaz', 'Tanzanite', 'Blue Zircon']
26
+ }.freeze
27
+
28
+ ##
29
+ # Outputs the birthstone(s) of the month for the date in the argument.
30
+ def self.stone(date)
31
+ key =
32
+ if date.instance_of?(Integer)
33
+ date
34
+ elsif date.instance_of?(String)
35
+ parsed_date = Date.parse(date)
36
+ parsed_date.month
37
+ elsif date.instance_of?(Date)
38
+ date.month
39
+ end
40
+ STONE_BY_MONTH[key] unless key.nil?
41
+ end
42
+ end
data/sig/birthgem.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Birthgem
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: birthgem
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - kaisumi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-01-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: You can find birthgem of entered month of birth.
14
+ email:
15
+ - kaisumi@langue-lab.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".rspec"
21
+ - ".rubocop.yml"
22
+ - Gemfile
23
+ - Gemfile.lock
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - lib/birthgem.rb
28
+ - lib/birthgem/version.rb
29
+ - sig/birthgem.rbs
30
+ homepage: https://github.com/kaisumi/birthgem
31
+ licenses:
32
+ - MIT
33
+ metadata:
34
+ homepage_uri: https://github.com/kaisumi/birthgem
35
+ source_code_uri: https://github.com/kaisumi/birthgem
36
+ changelog_uri: https://github.com/kaisumi/birthgem/blob/main/CHANGELOG.md
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 2.6.0
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubygems_version: 3.3.5
53
+ signing_key:
54
+ specification_version: 4
55
+ summary: Find your birthgem.
56
+ test_files: []