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 +4 -4
- data/README.md +29 -10
- data/lib/hokkaido_dialect/hokkaido_dialect.rb +76 -18
- data/lib/hokkaido_dialect/version.rb +1 -1
- data/lib/hokkaido_dialect.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 114f73732e0eab167da397c90ac08af9424d7b9e5a5f4744656f5026f548d2d5
|
4
|
+
data.tar.gz: 3fc9c9d7dba92ccde821ed5bd6578fa4dd8c35944502aaa33762f5503ad333c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dbc931fb1933e2867c9faa204307556f0574a258c0c2785df2bbd46eebea586a4939778ed84febba8060509753bdf5bc0dd5bf348612869fb722117b85d55cb
|
7
|
+
data.tar.gz: fdaf6d6cbb5c99ed6b9d55453a698748be1ea3c1b3207a0742a8a566441191a657caa1971b8cbee1c010fe8af3e194ad3f1888b4ab7c8ddd7799e75749146b30
|
data/README.md
CHANGED
@@ -1,38 +1,57 @@
|
|
1
1
|
# HokkaidoDialect
|
2
2
|
|
3
|
-
|
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
|
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
|
16
|
+
gem install hokkaido_dialect
|
21
17
|
```
|
22
18
|
|
23
19
|
## Usage
|
24
20
|
|
25
|
-
|
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 [
|
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/
|
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
|
-
|
3
|
-
{ dialect:
|
4
|
-
{ dialect:
|
5
|
-
{ dialect:
|
6
|
-
{ dialect:
|
7
|
-
{ dialect:
|
8
|
-
{ dialect:
|
9
|
-
{ dialect:
|
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
|
13
|
-
def self.
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
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
|
-
|
22
|
-
|
23
|
-
}
|
79
|
+
def correct_answer?(input)
|
80
|
+
index = input - 1
|
81
|
+
@choices[index] == @correct_usage
|
24
82
|
end
|
25
83
|
end
|
26
84
|
end
|
data/lib/hokkaido_dialect.rb
CHANGED
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:
|
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:
|
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.
|
44
|
+
rubygems_version: 3.6.9
|
45
45
|
specification_version: 4
|
46
46
|
summary: ๆฌ็ฉใฎๅๆตท้ๅผใจใจใปๅๆตท้ๅผใ่ฆๅใใใฏใคใบใงใใ
|
47
47
|
test_files: []
|