hokkaido_dialect 0.1.0 โ†’ 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d6c15fb218d88bca4ec76ad194e6a54647fac12ba395c4b501496f5558380ed
4
- data.tar.gz: f0002e9d8e789c152403cdfa76b57d6dfd3d0e72501eb4e565e6e49b24259eaa
3
+ metadata.gz: 114f73732e0eab167da397c90ac08af9424d7b9e5a5f4744656f5026f548d2d5
4
+ data.tar.gz: 3fc9c9d7dba92ccde821ed5bd6578fa4dd8c35944502aaa33762f5503ad333c7
5
5
  SHA512:
6
- metadata.gz: d1c8b88b164c51f0c868c72c551b63ca4e8261198153b21f4a2e5a199a988ac02243fd5fe5b92d95e6b223821bf3167e18735c42baa94880ea86aa1092fdfa97
7
- data.tar.gz: a6b9c74f1a27a498093addb714c792ea1ea45b4272854d25829cf3c68bca269ff433b90a50473f1a7ba284e4b17d90021e1d2934e4438085fe6be7bc020ff5f8
6
+ metadata.gz: 4dbc931fb1933e2867c9faa204307556f0574a258c0c2785df2bbd46eebea586a4939778ed84febba8060509753bdf5bc0dd5bf348612869fb722117b85d55cb
7
+ data.tar.gz: fdaf6d6cbb5c99ed6b9d55453a698748be1ea3c1b3207a0742a8a566441191a657caa1971b8cbee1c010fe8af3e194ad3f1888b4ab7c8ddd7799e75749146b30
data/README.md CHANGED
@@ -1,38 +1,57 @@
1
1
  # HokkaidoDialect
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- 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/hokkaido_dialect`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ HokkaidoDialect is a Ruby gem that provides a fun quiz to help you learn the Hokkaido dialect.
6
4
 
7
5
  ## Installation
8
6
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
7
  Install the gem and add to the application's Gemfile by executing:
12
8
 
13
9
  ```bash
14
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
10
+ bundle add hokkaido_dialect
15
11
  ```
16
12
 
17
13
  If bundler is not being used to manage dependencies, install the gem by executing:
18
14
 
19
15
  ```bash
20
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
16
+ gem install hokkaido_dialect
21
17
  ```
22
18
 
23
19
  ## Usage
24
20
 
25
- TODO: Write usage instructions here
21
+ Start an interactive quiz in IRB:
22
+
23
+ ```bash
24
+ % irb
25
+ irb(main):001> require 'hokkaido_dialect'
26
+ => true
27
+ irb(main):002> HokkaidoDialect::QuizGame.play
28
+ ```
29
+
30
+ ### Play a quiz
31
+
32
+ ```ruby
33
+ # 3 random questions (default)
34
+ HokkaidoDialect::QuizGame.play
35
+
36
+ # Specify the number of questions
37
+ HokkaidoDialect::QuizGame.play(5)
38
+
39
+ # Play with all questions
40
+ HokkaidoDialect::QuizGame.all
41
+ ```
42
+
43
+ You will be asked multiple-choice questions on the correct usage of the Hokkaido dialect.
44
+ Enjoy the quiz and become familiar with the Hokkaido dialect! ๐Ÿฆ€๐Ÿป๐Ÿ„โœจ
26
45
 
27
46
  ## Development
28
47
 
29
48
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
49
 
31
- 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).
50
+ 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 [hokkaido_dialect | RubyGems.org](https://rubygems.org/gems/hokkaido_dialect).
32
51
 
33
52
  ## Contributing
34
53
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hokkaido_dialect.
54
+ Bug reports and pull requests are welcome on GitHub at https://github.com/lemonade-37/hokkaido_dialect.
36
55
 
37
56
  ## License
38
57
 
@@ -1,26 +1,84 @@
1
1
  module HokkaidoDialect
2
- DIALECTS = [
3
- { dialect: "ใน", correct_usage: "ใ†ใพใ„ใน๏ผŸ", wrong_usage: "ๆค…ๅญใซๅบงใ‚‹ใ‚“ใ ใน" },
4
- { dialect: "ในใ•", correct_usage: "ๅคงไธˆๅคซใ ในใ•", wrong_usage: "ใƒใ‚คใƒใ‚คใ ในใ•" },
5
- { dialect: "ในใ‚„", correct_usage: "ใŠๅ‰ใ€ใกใ‚ƒใ‚“ใจ้€ฃ็ตกใ—ใ‚ใฃใฆ่จ€ใฃใŸในใ‚„", wrong_usage: "ใ‚ใฎไบบใ‹ใฃใ“ใ„ใ„ในใ‚„" },
6
- { dialect: "ใ—ใ‚‡ใ‚„", correct_usage: "ใ”ใฟ็ฝฎใใฃใฑใชใ—ใซใ—ใชใ„ใงใฃใฆ่จ€ใฃใŸใ—ใ‚‡ใ‚„", wrong_usage: "ๆ—ญๅทใซ่กŒใใ—ใ‚‡ใ‚„" },
7
- { dialect: "ใ—ใ‚‡", correct_usage: "้‡ง่ทฏ่กŒใใฎใƒใ‚นใฃใŸใ‚‰ๆฌก3ๆ™‚้–“ๅพ…ใŸใชใ„ใจใชใ„ใ—ใ‚‡", wrong_usage: "ใ“ใชใ„ใ ๅฏŒ่‰ฏ้‡Žใซ่กŒใฃใฆใใŸใ—ใ‚‡" },
8
- { dialect: "ใชใพใ‚‰", correct_usage: "็ท ใ‚ใƒ‘ใƒ•ใ‚งใ€ใชใพใ‚‰็”˜ใ‹ใฃใŸ", wrong_usage: "ใชใพใ‚‰RubyKaigiใ ใญ" },
9
- { dialect: "ใ—ใŸใฃใ‘", correct_usage: "ใ“ใชใ„ใ ้›ชใ‹ใใ—ใŸใฃใ‘ใ€็ญ‹่‚‰็—›ใซใชใฃใŸใ•", wrong_usage: "้›ปๆฐ—ๆถˆใ—ใŸใฃใ‘" },
2
+ QUESTIONS = [
3
+ { dialect: 'ใน', correct_usage: 'ใ†ใพใ„ใน๏ผŸ', wrong_usage: 'ๆค…ๅญใซๅบงใ‚‹ใ‚“ใ ใน' },
4
+ { dialect: 'ในใ•', correct_usage: 'ๅคงไธˆๅคซใ ในใ•', wrong_usage: 'ใƒใ‚คใƒใ‚คใ ในใ•' },
5
+ { dialect: 'ในใ‚„', correct_usage: 'ใŠๅ‰ใ€ใกใ‚ƒใ‚“ใจ้€ฃ็ตกใ—ใ‚ใฃใฆ่จ€ใฃใŸในใ‚„', wrong_usage: 'ใ‚ใฎไบบใ‹ใฃใ“ใ„ใ„ในใ‚„' },
6
+ { dialect: 'ใ—ใ‚‡ใ‚„', correct_usage: 'ใ”ใฟ็ฝฎใใฃใฑใชใ—ใซใ—ใชใ„ใงใฃใฆ่จ€ใฃใŸใ—ใ‚‡ใ‚„', wrong_usage: 'ๆ—ญๅทใซ่กŒใใ—ใ‚‡ใ‚„' },
7
+ { dialect: 'ใ—ใ‚‡', correct_usage: '้‡ง่ทฏ่กŒใใฎใƒใ‚นใฃใŸใ‚‰ๆฌก3ๆ™‚้–“ๅพ…ใŸใชใ„ใจใชใ„ใ—ใ‚‡', wrong_usage: 'ใ“ใชใ„ใ ๅฏŒ่‰ฏ้‡Žใซ่กŒใฃใฆใใŸใ—ใ‚‡' },
8
+ { dialect: 'ใชใพใ‚‰', correct_usage: '็ท ใ‚ใƒ‘ใƒ•ใ‚งใ€ใชใพใ‚‰็”˜ใ‹ใฃใŸ', wrong_usage: 'ใชใพใ‚‰RubyKaigiใ ใญ' },
9
+ { dialect: 'ใ—ใŸใฃใ‘', correct_usage: 'ใ“ใชใ„ใ ้›ชใ‹ใใ—ใŸใฃใ‘ใ€็ญ‹่‚‰็—›ใซใชใฃใŸใ•', wrong_usage: '้›ปๆฐ—ๆถˆใ—ใŸใฃใ‘' },
10
+ { dialect: 'ใ—ใŸใ‚‰', correct_usage: 'ใ—ใŸใ‚‰ใญใ€ใพใŸใญ', wrong_usage: 'ใ—ใŸใ‚‰ใ€ๆฅฝใ—ใ„ใญ' },
11
+ { dialect: 'ใชใ—ใฆ', correct_usage: 'ใชใ—ใฆใใ‚“ใชใ“ใจใชใฃใŸใ‚“ใ ในใ‹', wrong_usage: 'ใชใ—ใฆใ€ใŠใฟใใ˜ๅคงๅ‰ใ ใฃใŸใ•' },
12
+ { dialect: 'ใชใ‚“ใ‚‚', correct_usage: 'ใชใ‚“ใ‚‚ใงใ™', wrong_usage: 'ใ“ใฎ่พบๆฎบ้ขจๆ™ฏใงใ€ใชใ‚“ใ‚‚ใ ใญ' },
13
+ { dialect: 'ใ€œใ•ใ‚‹', correct_usage: 'ใƒ‡ใƒผใ‚ฟใƒ™ใƒผใ‚นๅ‰Š้™คใ—ใ•ใ•ใฃใŸโ€ฆ', wrong_usage: 'ใ‚‚ใ†ใ™ใใ“ใฎๆœฌใ‚‚่ชญใฟ็ต‚ใ‚ใ‚‰ใ•ใ‚‹ใญ' },
14
+ { dialect: 'ใ—ใ‚ƒ๏ผˆใฒใ‚ƒ๏ผ‰ใฃใ“ใ„', correct_usage: 'ๆ‰‹ใ—ใ‚ƒใฃใ“๏ผ', wrong_usage: 'ใ—ใ‚ƒใฃใ“ใ„ๅๅ‰ใ ใญใ€œ' },
15
+ { dialect: 'ใ‹ใฃใกใ‚ƒใ', correct_usage: 'ๆ„›ใ—ใฆใ‚‹็Œซใซใ‹ใฃใกใ‚ƒใ‹ใ‚ŒใŸโ€ฆ', wrong_usage: 'ใ‹ใฃใกใ‚ƒใ้ฃพใ‚Šไป˜ใ‘ใ—ใ‚ˆ' },
16
+ { dialect: 'ใ‚ใ‚„', correct_usage: 'ใ‚ใ‚“ใŸใฎ้ƒจๅฑ‹ใ€ใ‚ใ‚„ใ ใญ', wrong_usage: 'ไธ€้ขใฎใƒใƒฅใƒผใƒชใƒƒใƒ—็•‘ใ€ใ‚ใ‚„ใ ใญใ€œ' },
17
+ { dialect: 'ใฏใ‚“ใ‹ใใ•ใ„', correct_usage: 'ใ‚„ใ‚ใชใ€ใฏใ‚“ใ‹ใใ•ใ„ใ‹ใ‚‰', wrong_usage: 'ใ“ใฎ้ƒจๅฑ‹ใ€ใฏใ‚“ใ‹ใใ•ใ„ใช' },
18
+ { dialect: 'ใ„ใšใ„', correct_usage: 'ใ“ใฎใƒ‹ใƒƒใƒˆใกใใกใใ—ใฆใ„ใšใ„', wrong_usage: 'ใกใ‚‡ใฃใจใ‚ซใƒฉใ‚ชใ‚ฑใ„ใšใ„ใ‹ใ‚‰ๅธฐใ‚ใ†ใ‹ใช' },
19
+ { dialect: 'ใ‚ใšใพใ—ใ„', correct_usage: 'ใ‚ใšใพใ—ใใชใ„ใญ', wrong_usage: 'ใ‚ใฎๅญใ€ใ‚ใฃใกใ‚ƒใ‚ใšใพใ—ใ„' },
20
+ { dialect: 'ใฏใ', correct_usage: 'ใปใ‚‰ใ€ๆ—ฉใๆ‰‹่ข‹ใฏใใช', wrong_usage: 'ๅบŠใฏใ„ใฆใŠใ„ใฆ' },
21
+ { dialect: 'ใ“ใ‚ใ„', correct_usage: 'ใ“ใ‚ใ„ใ‚“ใงใ—ใ‚‡ใ€ไผ‘ใ‚“ใงใช', wrong_usage: 'ใƒ’ใ‚ฐใƒžใ€ใ“ใ‚ใ„' },
22
+ { dialect: 'ใกใ‚‡ใ™', correct_usage: 'ใกใ‚‡ใ™ใชใ—', wrong_usage: 'ใ‚„ใฃใปใƒผ๏ผใกใ‚‡ใ™๏ผ' },
23
+ { dialect: 'ใ†ใ‚‹ใ‹ใ™', correct_usage: '้ฃŸใน็ต‚ใ‚ใฃใŸ้ฃŸๅ™จใ†ใ‚‹ใ‹ใ—ใจใ„ใฆ', wrong_usage: '็›ฎใŒใ†ใ‚‹ใ‹ใ•ใฃใฆใใŸ' },
24
+ { dialect: 'ใŠใฃใกใ‚ƒใ‚“ใ“', correct_usage: 'ไธŠๆ‰‹ใซใŠใฃใกใ‚ƒใ‚“ใ“ใ—ใฆใ€ใ‚ใ‚“ใ“ใ„ใญ', wrong_usage: 'ใŠใฃใกใ‚ƒใ‚“ใ“ใ—ใฆ้ ‚ใ„ใฆใ„ใ„ใงใ™ใ‹๏ผŸ' },
25
+ { dialect: 'ใผใฃใ“', correct_usage: 'ใ“ใฎใผใฃใ“ใ‚’ใ€้‡ฃ็ซฟใจใ™ใ‚‹', wrong_usage: 'ใฒใชใŸใผใฃใ“' },
26
+ { dialect: 'ใ‚ใŸใ‚‹', correct_usage: 'ใŠๅผๅฝ“1ไบบ1ใคใ‚ใŸใ‚‹ใ‹ใ‚‰ใญ', wrong_usage: '็”Ÿ็‰ก่ ฃ้ฃŸในใฆใ‚ใŸใฃใŸ' }
10
27
  ]
11
28
 
12
- class Question
13
- def self.ask
14
- dialect = DIALECTS.sample
15
- correct_usage = dialect[:correct_usage]
16
- incorrect_usage = dialect[:wrong_usage]
29
+ class QuizGame
30
+ def self.play(number_of_questions = 3)
31
+ play_questions(QUESTIONS.sample(number_of_questions))
32
+ end
33
+
34
+ def self.all
35
+ play_questions(QUESTIONS.shuffle)
36
+ end
37
+
38
+ def self.play_questions(questions)
39
+ results = questions.map do |question|
40
+ new(question).ask_and_check
41
+ end
42
+ puts "#{questions.size}ๅ•ไธญ#{results.count(true)}ๅ•ๆญฃ่งฃ๏ผ"
43
+ end
44
+
45
+ def initialize(question = QUESTIONS.sample)
46
+ wrong_usage = question[:wrong_usage]
47
+ @dialect = question[:dialect]
48
+ @correct_usage = question[:correct_usage]
49
+ @choices = [wrong_usage, @correct_usage].shuffle
50
+ end
51
+
52
+ def ask_and_check
53
+ puts question_body
17
54
 
18
- choices = [correct_usage, incorrect_usage].shuffle
55
+ input = input_until_valid
56
+
57
+ correct_answer?(input).tap do |judgment|
58
+ puts judgment ? 'ๆญฃ่งฃ๏ผ๐ŸŽ‰โœจ๐Ÿฆ€' : 'ไธๆญฃ่งฃโ€ฆ๐Ÿ„'
59
+ end
60
+ end
61
+
62
+ def question_body
63
+ "ๆฌกใฎๆ–‡็ซ ใงๆญฃใ—ใ„ใ€Œ#{@dialect}ใ€ใฎไฝฟใ„ๆ–นใฏใฉใฃใก๏ผŸ\n1. #{@choices[0]}\n2. #{@choices[1]}"
64
+ end
65
+
66
+ def input_until_valid
67
+ loop do
68
+ print '็•ชๅทใ‚’ๅ…ฅๅŠ›ใ—ใฆใใ ใ•ใ„๏ผˆ1 or 2๏ผ‰: '
69
+ input = $stdin.gets.to_i
70
+
71
+ if [1, 2].include?(input)
72
+ return input
73
+ end
74
+
75
+ puts '็„กๅŠนใชๅ…ฅๅŠ›ใงใ™๏ผ1ใพใŸใฏ2ใ‚’ๅ…ฅๅŠ›ใ—ใฆใใ ใ•ใ„๐Ÿป'
76
+ end
77
+ end
19
78
 
20
- {
21
- question: "ๆฌกใฎๆ–‡็ซ ใงๆญฃใ—ใ„ๅŒ—ๆตท้“ๅผใฏใฉใฃใก๏ผŸ\n1. #{choices[0]}\n2. #{choices[1]}",
22
- answer: choices.index(correct_usage) + 1
23
- }
79
+ def correct_answer?(input)
80
+ index = input - 1
81
+ @choices[index] == @correct_usage
24
82
  end
25
83
  end
26
84
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HokkaidoDialect
4
- VERSION = "0.1.0"
4
+ VERSION = "1.0.0"
5
5
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "hokkaido_dialect/version"
4
+ require_relative "hokkaido_dialect/hokkaido_dialect"
4
5
 
5
6
  module HokkaidoDialect
6
7
  class Error < StandardError; end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hokkaido_dialect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lemonade_37
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-04-18 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: ๆœฌ็‰ฉใฎๅŒ—ๆตท้“ๅผใจใ‚จใ‚ปๅŒ—ๆตท้“ๅผใ‚’่ฆ‹ๅˆ†ใ‘ใ‚‹ใ‚ฏใ‚คใ‚บใงใ™ใ€‚
13
13
  executables: []
@@ -41,7 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  requirements: []
44
- rubygems_version: 3.6.2
44
+ rubygems_version: 3.6.9
45
45
  specification_version: 4
46
46
  summary: ๆœฌ็‰ฉใฎๅŒ—ๆตท้“ๅผใจใ‚จใ‚ปๅŒ—ๆตท้“ๅผใ‚’่ฆ‹ๅˆ†ใ‘ใ‚‹ใ‚ฏใ‚คใ‚บใงใ™ใ€‚
47
47
  test_files: []