ruby_learner 1.2.0 → 1.2.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.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/contents/questions/sequential_check/section_10/part_1/lib/answer.rb +5 -7
  4. data/contents/questions/sequential_check/section_10/part_1/lib/sentence.org +10 -8
  5. data/contents/questions/sequential_check/section_10/part_1/lib/workplace.rb +1 -1
  6. data/contents/questions/sequential_check/section_10/part_1/spec/workplace_spec.rb +4 -4
  7. data/contents/questions/sequential_check/section_10/part_2/lib/answer.rb +6 -7
  8. data/contents/questions/sequential_check/section_10/part_2/lib/sentence.org +9 -7
  9. data/contents/questions/sequential_check/section_10/part_2/lib/workplace.rb +1 -1
  10. data/contents/questions/sequential_check/section_10/part_2/spec/workplace_spec.rb +4 -9
  11. data/contents/questions/sequential_check/section_10/part_3/lib/answer.rb +12 -0
  12. data/contents/questions/sequential_check/section_10/part_3/lib/sentence.org +8 -0
  13. data/contents/questions/sequential_check/section_10/part_3/lib/workplace.rb +1 -0
  14. data/contents/questions/sequential_check/{section_6/part_4 → section_10/part_3}/spec/spec_helper.rb +0 -0
  15. data/contents/questions/sequential_check/section_10/part_3/spec/workplace_spec.rb +10 -0
  16. data/contents/questions/sequential_check/section_2/foo/nbar/nbaz/n +0 -0
  17. data/contents/questions/sequential_check/section_2/part_3/lib/answer.rb +3 -6
  18. data/contents/questions/sequential_check/section_2/part_3/lib/sentence.org +2 -0
  19. data/contents/questions/sequential_check/section_2/part_3/lib/workplace.rb +0 -4
  20. data/contents/questions/sequential_check/section_2/part_3/spec/workplace_spec.rb +8 -7
  21. data/contents/questions/sequential_check/section_3/part_2/lib/answer.rb +3 -5
  22. data/contents/questions/sequential_check/section_3/part_2/lib/workplace.rb +0 -4
  23. data/contents/questions/sequential_check/section_3/part_2/spec/workplace_spec.rb +8 -7
  24. data/contents/questions/sequential_check/section_4/part_2/lib/answer.rb +2 -2
  25. data/contents/questions/sequential_check/section_4/part_2/lib/workplace.rb +1 -1
  26. data/contents/questions/sequential_check/section_4/part_3/lib/answer.rb +8 -10
  27. data/contents/questions/sequential_check/section_4/part_3/lib/sentence.org +1 -0
  28. data/contents/questions/sequential_check/section_4/part_3/lib/workplace.rb +1 -3
  29. data/contents/questions/sequential_check/section_4/part_3/spec/workplace_spec.rb +6 -7
  30. data/contents/questions/sequential_check/section_6/part_2/lib/answer.rb +9 -4
  31. data/contents/questions/sequential_check/section_6/part_2/lib/sentence.org +35 -2
  32. data/contents/questions/sequential_check/section_6/part_2/lib/workplace.rb +2 -0
  33. data/contents/questions/sequential_check/section_6/part_2/spec/workplace_spec.rb +9 -10
  34. data/contents/questions/sequential_check/section_6/part_3/lib/answer.rb +5 -5
  35. data/contents/questions/sequential_check/section_6/part_3/lib/sentence.org +44 -5
  36. data/contents/questions/sequential_check/section_6/part_3/lib/workplace.rb +3 -0
  37. data/contents/questions/sequential_check/section_6/part_3/spec/workplace_spec.rb +2 -2
  38. data/contents/questions/sequential_check/section_7/part_1/lib/answer.rb +5 -3
  39. data/contents/questions/sequential_check/section_7/part_1/lib/sentence.org +22 -16
  40. data/contents/questions/sequential_check/section_7/part_1/spec/workplace_spec.rb +8 -8
  41. data/contents/questions/sequential_check/section_7/part_2/lib/answer.rb +6 -6
  42. data/contents/questions/sequential_check/section_7/part_2/lib/sentence.org +23 -22
  43. data/contents/questions/sequential_check/section_7/part_2/spec/workplace_spec.rb +11 -5
  44. data/contents/questions/sequential_check/section_7/part_3/lib/answer.rb +13 -0
  45. data/contents/questions/sequential_check/section_7/part_3/lib/sentence.org +24 -0
  46. data/contents/questions/sequential_check/section_7/part_3/lib/workplace.rb +4 -0
  47. data/contents/questions/sequential_check/section_7/part_3/spec/spec_helper.rb +100 -0
  48. data/contents/questions/sequential_check/section_7/part_3/spec/workplace_spec.rb +15 -0
  49. data/contents/questions/sequential_check/section_8/part_1/lib/answer.rb +11 -6
  50. data/contents/questions/sequential_check/section_8/part_1/lib/sentence.org +66 -10
  51. data/contents/questions/sequential_check/section_8/part_1/lib/workplace.rb +10 -0
  52. data/contents/questions/sequential_check/section_8/part_1/spec/workplace_spec.rb +28 -9
  53. data/contents/questions/sequential_check/section_8/part_2/lib/answer.rb +14 -0
  54. data/contents/questions/sequential_check/section_8/part_2/lib/sentence.org +80 -0
  55. data/contents/questions/sequential_check/section_8/part_2/lib/workplace.rb +1 -0
  56. data/contents/questions/sequential_check/section_8/part_2/spec/spec_helper.rb +100 -0
  57. data/contents/questions/sequential_check/section_8/part_2/spec/workplace_spec.rb +34 -0
  58. data/contents/questions/sequential_check/section_8/part_3/lib/answer.rb +20 -0
  59. data/contents/questions/sequential_check/section_8/part_3/lib/sentence.org +80 -0
  60. data/contents/questions/sequential_check/section_8/part_3/lib/workplace.rb +11 -0
  61. data/contents/questions/sequential_check/section_8/part_3/spec/spec_helper.rb +100 -0
  62. data/contents/questions/sequential_check/section_8/part_3/spec/workplace_spec.rb +34 -0
  63. data/contents/questions/sequential_check/section_9/part_1/lib/answer.rb +9 -4
  64. data/contents/questions/sequential_check/section_9/part_1/lib/sentence.org +93 -4
  65. data/contents/questions/sequential_check/section_9/part_1/spec/workplace_spec.rb +14 -5
  66. data/contents/questions/sequential_check/section_9/part_2/lib/answer.rb +8 -5
  67. data/contents/questions/sequential_check/section_9/part_2/lib/sentence.org +92 -10
  68. data/contents/questions/sequential_check/section_9/part_2/spec/workplace_spec.rb +14 -5
  69. data/contents/questions/sequential_check/section_9/part_3/lib/answer.rb +7 -9
  70. data/contents/questions/sequential_check/section_9/part_3/lib/sentence.org +93 -4
  71. data/contents/questions/sequential_check/section_9/part_3/spec/workplace_spec.rb +14 -5
  72. data/lib/ruby_learner/sequential_main.rb +25 -12
  73. data/lib/ruby_learner/version.rb +1 -1
  74. metadata +26 -7
  75. data/contents/questions/sequential_check/section_6/part_4/lib/answer.rb +0 -9
  76. data/contents/questions/sequential_check/section_6/part_4/lib/sentence.org +0 -12
  77. data/contents/questions/sequential_check/section_6/part_4/lib/workplace.rb +0 -1
  78. data/contents/questions/sequential_check/section_6/part_4/spec/workplace_spec.rb +0 -9
@@ -1,10 +1,19 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require "open3"
3
3
 
4
- RSpec.describe "ARGV-check" do
5
- it 'given 3 "for-read.txt", return 4' do
6
- workshop = "#{ENV['HOME']}/.ruby_learner/workshop"
7
- stdout, stderr, status = Open3.capture3("ruby #{workshop}/lib/workplace.rb 'ドンブラコ' #{workshop}/lib/for-read.txt")
8
- expect { puts stdout }.to output("おばあさんが川でせんたくをしていると、ドンブラコ、ドンブラコと、大きな桃が流れてきました。\n").to_stdout
4
+ workshop = "#{ENV['HOME']}/.ruby_learner/workshop"
5
+
6
+ RSpec.describe "regular-exp-check" do
7
+ it 'given "R8uby, Hello\n", return "match\n"' do
8
+ stdout, stderr, status = Open3.capture3("ruby #{workshop}/lib/workplace.rb", :stdin_data=>"R8uby, Hello\n")
9
+ expect { puts stdout }.to output("match.\n").to_stdout
10
+ end
11
+ it 'given "A9 is Hello\n", return "match\n"' do
12
+ stdout, stderr, status = Open3.capture3("ruby #{workshop}/lib/workplace.rb", :stdin_data=> "A9 is Hello\n")
13
+ expect { puts stdout }.to output("match.\n").to_stdout
14
+ end
15
+ it 'given "Ruby, tanaka\n", return "not match\n"' do
16
+ stdout, stderr, status = Open3.capture3("ruby #{workshop}/lib/workplace.rb", :stdin_data=>"Ruby, tanaka\n")
17
+ expect { puts stdout }.to output("not match.\n").to_stdout
9
18
  end
10
19
  end
@@ -55,13 +55,12 @@ class SequentialMain
55
55
  puts "section_3\t 1~3\t standard_I/O summary"
56
56
  puts "section_4\t 1~3\t comparisons & conditionals"
57
57
  puts "section_5\t 1~3\t loop_methods"
58
- puts "section_6\t 1~4\t array & hash"
59
- puts "section_7\t 1~2\t function"
60
- puts "section_8\t 1~1\t class"
61
- puts "section_9\t 1~3\t symbol"
62
- puts "section_10\t 1~2\t regular_expression"
63
- puts "section_11\t 1~2\t file_operation"
64
- puts "section_12\t 1~2\t library"
58
+ puts "section_6\t 1~3\t array & hash & symbol"
59
+ puts "section_7\t 1~3\t function"
60
+ puts "section_8\t 1~3\t class"
61
+ puts "section_9\t 1~3\t regular_expression"
62
+ puts "section_10\t 1~2\t file_operation"
63
+ puts "section_11\t 1~2\t library"
65
64
  end
66
65
 
67
66
  def get_final_history()
@@ -141,9 +140,6 @@ class SequentialMain
141
140
  elsif final_par == 2
142
141
  next_sec = 6
143
142
  next_par = 3
144
- elsif final_par == 3
145
- next_sec = 6
146
- next_par = 4
147
143
  else
148
144
  next_sec = 7
149
145
  next_par = 1
@@ -152,13 +148,24 @@ class SequentialMain
152
148
  if final_par == 1
153
149
  next_sec = 7
154
150
  next_par = 2
151
+ elsif final_par == 2
152
+ next_sec = 7
153
+ next_par = 3
155
154
  else
156
155
  next_sec = 8
157
156
  next_par = 1
158
157
  end
159
158
  elsif final_sec == 8
160
- next_sec = 9
161
- next_par = 1
159
+ if final_par == 1
160
+ next_sec = 8
161
+ next_par = 2
162
+ elsif final_par == 2
163
+ next_sec = 8
164
+ next_par = 3
165
+ else
166
+ next_sec = 9
167
+ next_par = 1
168
+ end
162
169
  elsif final_sec == 9
163
170
  if final_par == 1
164
171
  next_sec = 9
@@ -174,6 +181,9 @@ class SequentialMain
174
181
  if final_par == 1
175
182
  next_sec = 10
176
183
  next_par = 2
184
+ elsif final_par == 2
185
+ next_sec = 10
186
+ next_par = 3
177
187
  else
178
188
  next_sec = 11
179
189
  next_par = 1
@@ -182,6 +192,9 @@ class SequentialMain
182
192
  if final_par == 1
183
193
  next_sec = 11
184
194
  next_par = 2
195
+ elsif final_par == 2
196
+ next_sec = 11
197
+ next_par = 3
185
198
  else
186
199
  next_sec = 1
187
200
  next_par = 1
@@ -1,3 +1,3 @@
1
1
  module RubyLearner
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_learner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takaki Otsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-12 00:00:00.000000000 Z
11
+ date: 2018-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -165,6 +165,11 @@ files:
165
165
  - contents/questions/sequential_check/section_10/part_2/lib/workplace.rb
166
166
  - contents/questions/sequential_check/section_10/part_2/spec/spec_helper.rb
167
167
  - contents/questions/sequential_check/section_10/part_2/spec/workplace_spec.rb
168
+ - contents/questions/sequential_check/section_10/part_3/lib/answer.rb
169
+ - contents/questions/sequential_check/section_10/part_3/lib/sentence.org
170
+ - contents/questions/sequential_check/section_10/part_3/lib/workplace.rb
171
+ - contents/questions/sequential_check/section_10/part_3/spec/spec_helper.rb
172
+ - contents/questions/sequential_check/section_10/part_3/spec/workplace_spec.rb
168
173
  - contents/questions/sequential_check/section_11/part_1/lib/answer.rb
169
174
  - contents/questions/sequential_check/section_11/part_1/lib/sentence.org
170
175
  - contents/questions/sequential_check/section_11/part_1/lib/workplace.rb
@@ -175,6 +180,10 @@ files:
175
180
  - contents/questions/sequential_check/section_11/part_2/lib/workplace.rb
176
181
  - contents/questions/sequential_check/section_11/part_2/spec/spec_helper.rb
177
182
  - contents/questions/sequential_check/section_11/part_2/spec/workplace_spec.rb
183
+ - |
184
+ contents/questions/sequential_check/section_2/foo
185
+ bar
186
+ baz
178
187
  - contents/questions/sequential_check/section_2/part_1/lib/answer.rb
179
188
  - contents/questions/sequential_check/section_2/part_1/lib/sentence.org
180
189
  - contents/questions/sequential_check/section_2/part_1/lib/workplace.rb
@@ -250,11 +259,6 @@ files:
250
259
  - contents/questions/sequential_check/section_6/part_3/lib/workplace.rb
251
260
  - contents/questions/sequential_check/section_6/part_3/spec/spec_helper.rb
252
261
  - contents/questions/sequential_check/section_6/part_3/spec/workplace_spec.rb
253
- - contents/questions/sequential_check/section_6/part_4/lib/answer.rb
254
- - contents/questions/sequential_check/section_6/part_4/lib/sentence.org
255
- - contents/questions/sequential_check/section_6/part_4/lib/workplace.rb
256
- - contents/questions/sequential_check/section_6/part_4/spec/spec_helper.rb
257
- - contents/questions/sequential_check/section_6/part_4/spec/workplace_spec.rb
258
262
  - contents/questions/sequential_check/section_7/part_1/lib/answer.rb
259
263
  - contents/questions/sequential_check/section_7/part_1/lib/sentence.org
260
264
  - contents/questions/sequential_check/section_7/part_1/lib/workplace.rb
@@ -265,11 +269,26 @@ files:
265
269
  - contents/questions/sequential_check/section_7/part_2/lib/workplace.rb
266
270
  - contents/questions/sequential_check/section_7/part_2/spec/spec_helper.rb
267
271
  - contents/questions/sequential_check/section_7/part_2/spec/workplace_spec.rb
272
+ - contents/questions/sequential_check/section_7/part_3/lib/answer.rb
273
+ - contents/questions/sequential_check/section_7/part_3/lib/sentence.org
274
+ - contents/questions/sequential_check/section_7/part_3/lib/workplace.rb
275
+ - contents/questions/sequential_check/section_7/part_3/spec/spec_helper.rb
276
+ - contents/questions/sequential_check/section_7/part_3/spec/workplace_spec.rb
268
277
  - contents/questions/sequential_check/section_8/part_1/lib/answer.rb
269
278
  - contents/questions/sequential_check/section_8/part_1/lib/sentence.org
270
279
  - contents/questions/sequential_check/section_8/part_1/lib/workplace.rb
271
280
  - contents/questions/sequential_check/section_8/part_1/spec/spec_helper.rb
272
281
  - contents/questions/sequential_check/section_8/part_1/spec/workplace_spec.rb
282
+ - contents/questions/sequential_check/section_8/part_2/lib/answer.rb
283
+ - contents/questions/sequential_check/section_8/part_2/lib/sentence.org
284
+ - contents/questions/sequential_check/section_8/part_2/lib/workplace.rb
285
+ - contents/questions/sequential_check/section_8/part_2/spec/spec_helper.rb
286
+ - contents/questions/sequential_check/section_8/part_2/spec/workplace_spec.rb
287
+ - contents/questions/sequential_check/section_8/part_3/lib/answer.rb
288
+ - contents/questions/sequential_check/section_8/part_3/lib/sentence.org
289
+ - contents/questions/sequential_check/section_8/part_3/lib/workplace.rb
290
+ - contents/questions/sequential_check/section_8/part_3/spec/spec_helper.rb
291
+ - contents/questions/sequential_check/section_8/part_3/spec/workplace_spec.rb
273
292
  - contents/questions/sequential_check/section_9/part_1/lib/answer.rb
274
293
  - contents/questions/sequential_check/section_9/part_1/lib/sentence.org
275
294
  - contents/questions/sequential_check/section_9/part_1/lib/workplace.rb
@@ -1,9 +0,0 @@
1
- # section_6/part_4/answer.rb
2
- # 6-4-array-puts.rb
3
- nums = [3, 1, 4, 1, 5]
4
-
5
- print nums, "\n"
6
-
7
- nums.each do |n|
8
- puts n
9
- end
@@ -1,12 +0,0 @@
1
- 配列全体を表示してから、配列の要素を順に表示するプログラムを作成せよ。
2
- ただし、配列はプログラム内で定義すること。
3
-
4
-
5
- - eachメソッド
6
-
7
- 配列名.each do |変数|
8
- 繰り返したい処理(|変数|で指定された変数を含む)
9
- end
10
-
11
- eachメソッドは、配列の要素すべてにアクセスする必要がある際に用いられる。
12
- 配列から要素を1つずつ取り出して、|変数|で指定された変数に代入して処理を繰り返し実行する。
@@ -1 +0,0 @@
1
- # section_6/part_4/workplace.rb
@@ -1,9 +0,0 @@
1
- require "open3"
2
-
3
- RSpec.describe "array" do
4
- it 'put some datas' do
5
- workshop = "#{ENV['HOME']}/.ruby_learner/workshop"
6
- stdout, stderr, status = Open3.capture3("ruby #{workshop}/lib/workplace.rb")
7
- expect { puts stdout }.to output("[3, 1, 4, 1, 5]\n3\n1\n4\n1\n5\n").to_stdout
8
- end
9
- end