sake_ruby 0.1.0 → 0.1.1

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: b6b4eb495493601cc7db6c8e9df02a396793d1903cb67fb5711c4073d9462721
4
- data.tar.gz: c8a542a63c1317772b5fa5d327535f38d5681aa2d05f4c9a564b3853e3e14a56
3
+ metadata.gz: 318310b4e5687de269010846fd0d9c49c75b49879c8aa77a4d33d37dd4147dce
4
+ data.tar.gz: 4141a3e1c384d17848eeb30016c6b6ab11e1e9e37139aa8b92e740b13d4df95c
5
5
  SHA512:
6
- metadata.gz: 77bae75490141489a2f1dfe876cf8b8f658f5e901dbddf7c7a78ceba7e0afa5eac9e8d044e22fb600c3dc7c9adfbb7b9dc0ec3832a5d841b4516211a72eee120
7
- data.tar.gz: f6e5183f432eb529621cbcc33ca9b7aa573df263067fdca0d11f50bfa3b108d2abbac7419a9ac74b8f3e81e855397a196ff75ce2fe54393d666f470402e78bdc
6
+ metadata.gz: 730edf06f93ede28b10dadb90aaf1a5f7935d65f47059ddea17dd37308ec00d7dfe92f6fa2b8f71ab43516f769ec88c3347fa55b66aa3af459acf11b0c3e3c0b
7
+ data.tar.gz: d4729b81b42f85bc6387c9a04f8d8d61d5bae47dcbbb8ae59b05ed187a3f31a44a08cdcabb2ad8bf95e686bf14df8e585389d6a83f7f593973467269643cfba0
data/.rubocop.yml CHANGED
@@ -34,3 +34,10 @@ RSpec/ExampleLength:
34
34
  Metrics/BlockLength:
35
35
  Exclude:
36
36
  - 'spec/**/*'
37
+
38
+ Metrics/MethodLength:
39
+ Enabled: false
40
+
41
+ Lint/AssignmentInCondition:
42
+ Exclude:
43
+ - 'lib/sake_ruby.rb'
data/README.md CHANGED
@@ -1,9 +1,4 @@
1
1
  # SakeRuby
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/sake_ruby`. 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
2
  ## Installation
8
3
 
9
4
  Add this line to your application's Gemfile:
@@ -22,7 +17,19 @@ Or install it yourself as:
22
17
 
23
18
  ## Usage
24
19
 
25
- TODO: Write usage instructions here
20
+ ```ruby
21
+ # all
22
+ SakeRuby.all
23
+ => [{:roman=>"junmaishu", :tokuteimeisho=>"純米酒", :raw_materials=>"米、米こうじ", :seimaibuai=>""}, {:roman=>"honjozoshu", :tokuteimeisho=>"本醸造酒", :raw_materials=>"米、米こうじ、醸造アルコール", :seimaibuai=>"70%以下"}, {:roman=>"daiginjoshu", :tokuteimeisho=>"大吟醸酒", :raw_materials=>"米、米こうじ、醸造アルコール", :seimaibuai=>"50%以下"}, {:roman=>"ginjoshu", :tokuteimeisho=>"吟醸酒", :raw_materials=>"米、米こうじ、醸造アルコール", :seimaibuai=>"60%以下"}, {:roman=>"tokubetsujunmaishu", :tokuteimeisho=>"特別純米酒", :raw_materials=>"米、米こうじ", :seimaibuai=>"60%以下又は特別な製造方法(要説明表示)"}, {:roman=>"tokubetsuhonjozoshu", :tokuteimeisho=>"特別本醸造酒", :raw_materials=>"米、米こうじ、醸造アルコール", :seimaibuai=>"60%以下又は特別な製造方法(要説明表示)"}, {:roman=>"junmaidaiginjoshu", :tokuteimeisho=>"純米大吟醸酒", :raw_materials=>"米、米こうじ", :seimaibuai=>"50%以下"}, {:roman=>"junmaiginjoshu", :tokuteimeisho=>"純米吟醸酒", :raw_materials=>"米、米こうじ", :seimaibuai=>"60%以下"}]
24
+
25
+ # select_random
26
+ SakeRuby.select_random
27
+ => {:roman=>"ginjoshu", :tokuteimeisho=>"吟醸酒", :raw_materials=>"米、米こうじ、醸造アルコール", :seimaibuai=>"60%以下"}
28
+
29
+ # find_by_tokuteimeisho
30
+ SakeRuby.find_by_tokuteimeisho("純米大吟醸酒")
31
+ => [{:roman=>"junmaidaiginjoshu", :tokuteimeisho=>"純米大吟醸酒", :raw_materials=>"米、米こうじ", :seimaibuai=>"50%以下"}]
32
+ ```
26
33
 
27
34
  ## Development
28
35
 
@@ -14,7 +14,7 @@
14
14
  :roman: junmaishu
15
15
  :tokuteimeisho: 純米酒
16
16
  :raw_materials: 米、米こうじ
17
- :seimaibuai: ""
17
+ :seimaibuai: 規制なし
18
18
 
19
19
  ---
20
20
  :roman: junmaiginjoshu
@@ -2,4 +2,4 @@
2
2
  :roman: junmaishu
3
3
  :tokuteimeisho: 純米酒
4
4
  :raw_materials: 米、米こうじ
5
- :seimaibuai: ""
5
+ :seimaibuai: 規制なし
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SakeRuby
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/sake_ruby.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "sake_ruby/version"
4
4
  require "yaml"
5
+ require "readline"
5
6
 
6
7
  module SakeRuby
7
8
  class NoTokuteimeishoError < StandardError; end
@@ -42,6 +43,34 @@ module SakeRuby
42
43
  MESSAGE
43
44
  end
44
45
 
46
+ def challenge
47
+ @question = select_random
48
+ puts "原材料: #{@question[:raw_materials]}, 精米歩合: #{@question[:seimaibuai]}"
49
+
50
+ stty_save = `stty -g`.chomp
51
+ begin
52
+ check_answer
53
+ rescue Interrupt
54
+ system("stty", stty_save)
55
+ exit
56
+ end
57
+ end
58
+
59
+ def check_answer
60
+ while answer = Readline.readline
61
+ case answer
62
+ when "降参"
63
+ puts "正解は、#{@question[:tokuteimeisho]}でした。"
64
+ exit
65
+ when @question[:tokuteimeisho]
66
+ puts "===正解==="
67
+ challenge
68
+ else
69
+ puts "---不正解---"
70
+ end
71
+ end
72
+ end
73
+
45
74
  private
46
75
 
47
76
  def raise_no_tokuteimeisho_error!(tokuteimeisho)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sake_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - watsumi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-05 00:00:00.000000000 Z
11
+ date: 2021-12-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: