ruby_learner 1.1.13 → 1.1.14

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
  SHA1:
3
- metadata.gz: a211a07e2c7f31b1ace1ff9bc17bc628787df2a8
4
- data.tar.gz: 1f013089aef7f67c771a356d39a4775208e02f9b
3
+ metadata.gz: be370545d9aade6b255d0909db6c631ca93e47ca
4
+ data.tar.gz: dfbaa28697b0cae3fe493b5dae675efc1a226905
5
5
  SHA512:
6
- metadata.gz: 57a37a03f505b27a5846ab88dabfa80cb27d10a07318e1750c6adc306743e68c1750e9ab4ae45e8ea26bad17b7545d7625df791cd586d0289a5a39f214373f12
7
- data.tar.gz: 7bf3612f92c5b834518fdb70542854d1b4f470bf6c182b2018362d352a1c75743ad82a8fa8426b02b99b593f7fb82099e1677533239dedfe37ec574007be6c9c
6
+ metadata.gz: e320fd45db78c78f621eb119baa8813ab085a9e96d31c3d8b9b31d4c9fefd7d99400eb5df24f5a00579b60d0d9516396d42089f9f4a543a4c50b5e580b5397e2
7
+ data.tar.gz: 2807680e2ca67e62c24bdc7fbbfb90e41e6254ce526400dc6291ec84486bd0b798a1505c6d703975af45accd727dffc4969d0d58dc4f2a854252dc1e8e90749e
@@ -32,7 +32,7 @@ class SequentialMain
32
32
  def drill_contents
33
33
  puts "section_1 1~3"
34
34
  puts "section_2 1~3"
35
- puts "section_3 1"
35
+ puts "section_3 1~2"
36
36
  puts "section_4 1"
37
37
  puts "section_5 1~2"
38
38
  puts "section_6 1~4"
@@ -82,8 +82,13 @@ class SequentialMain
82
82
  next_par = 1
83
83
  end
84
84
  elsif final_sec == 3
85
- next_sec = 4
86
- next_par = 1
85
+ if final_par == 1
86
+ next_sec = 3
87
+ next_par = 2
88
+ else
89
+ next_sec = 4
90
+ next_par = 1
91
+ end
87
92
  elsif final_sec == 4
88
93
  next_sec = 5
89
94
  next_par = 1
@@ -1,3 +1,3 @@
1
1
  module RubyLearner
2
- VERSION = "1.1.13"
2
+ VERSION = "1.1.14"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  -課題-
2
- コマンドラインから2つの引数を受け取って整数に変換し,その和,差,積,商を表示するプログラムを作成せよ.
2
+ コマンドラインから2つの引数を受け取って整数に変換し,その和,差,積,商をputsで表示するプログラムを作成せよ.
3
3
  ARGVは引数を文字列として受け取るため,そのままでは計算には使えないことに注意.
4
4
 
5
5
  * 識別子
@@ -1 +1,4 @@
1
- 3つの数値を変数x、y、zとして受け取り、縦x、横y、高さzの直方体の表面積と体積を求め、表示するプログラムを作成せよ。
1
+ -課題-
2
+ コマンドラインから3つの数値を変数x,y,zとして受け取り整数に変換せよ.
3
+ その後,縦x,横y,高さzの直方体の表面積と体積を求めよ.
4
+ その求めた値をputsで'表面積=(表面積の求めた値)'と'体積=(体積の求めた値)'の形で表示するプログラムを作成せよ.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  require "open3"
3
2
 
4
3
  RSpec.describe "ARGV-check" do
@@ -0,0 +1,8 @@
1
+ # section_3/part_2/answer.rb
2
+ # 3-2-cube.rb
3
+ def standard_input
4
+ array = STDIN.readlines
5
+
6
+ puts array
7
+ p array
8
+ end
@@ -0,0 +1,35 @@
1
+ -課題-
2
+ STDIN.readlinesを使用して複数の値を標準入力で取得する.
3
+ その後,受け取った値をputsとpで標準出力に出力するプログラムを作成せよ.
4
+
5
+ * 標準入力
6
+ - 標準入力とはキーボード入力のことです.
7
+ - 標準入力を行えるメソッドの紹介.
8
+ ** STDIN
9
+ - 標準入力のレシーバー
10
+ ** レシーバ
11
+ - ドット(.)の左側
12
+ ** gets
13
+ - get string の略
14
+ - 使用方法...変数 = STDIN.gets
15
+ - 機能...標準入力にキーボード入力された1行の文字列を取得する.
16
+ ** readlines
17
+ - 使用方法...変数 = STDIN.readlines
18
+ - 機能...複数行の文字列を,1行ごとの配列として取得する.入力を終了する場合はCtrl+Dを行う.
19
+ ** ARGV
20
+ - 使用方法...ARGVを書いたファイルを実行する場合に,スペースを区切りに入力文字を記入していく.
21
+ ex) ruby argv.rb a b c d
22
+ - 機能...コマンドラインから引数として与えられた文字列を格納する配列オブジェクト.
23
+
24
+ * 標準出力
25
+ - 引数として与えられた文字列を標準出力に出力するメソッドの紹介.
26
+ ** print
27
+ - 使用方法...print 引数
28
+ - 機能...引数のオブジェクトを文字列に変換して標準出力に出力する.
29
+ ** puts
30
+ - 使用方法...puts 引数
31
+ - 機能...引数のオブジェクトを文字列に変換し、改行を加えて標準出力に出力する.
32
+ ** p
33
+ - 使用方法...p 引数
34
+ - 機能...引数のオブジェクトを分かりやすい文字列にして標準出力に出力する.
35
+ ex) 文字列であれば””で囲まれていて、数値はそのま出力する末尾にはそれぞれ改行が付け足される..
@@ -0,0 +1,5 @@
1
+ # section_3/part_2/workplace.rb
2
+ def standard_input
3
+ # add your code
4
+
5
+ end
@@ -0,0 +1,100 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ # rspec-expectations config goes here. You can use an alternate
18
+ # assertion/expectation library such as wrong or the stdlib/minitest
19
+ # assertions if you prefer.
20
+ config.expect_with :rspec do |expectations|
21
+ # This option will default to `true` in RSpec 4. It makes the `description`
22
+ # and `failure_message` of custom matchers include text for helper methods
23
+ # defined using `chain`, e.g.:
24
+ # be_bigger_than(2).and_smaller_than(4).description
25
+ # # => "be bigger than 2 and smaller than 4"
26
+ # ...rather than:
27
+ # # => "be bigger than 2"
28
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
+ end
30
+
31
+ # rspec-mocks config goes here. You can use an alternate test double
32
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
33
+ config.mock_with :rspec do |mocks|
34
+ # Prevents you from mocking or stubbing a method that does not exist on
35
+ # a real object. This is generally recommended, and will default to
36
+ # `true` in RSpec 4.
37
+ mocks.verify_partial_doubles = true
38
+ end
39
+
40
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
+ # have no way to turn it off -- the option exists only for backwards
42
+ # compatibility in RSpec 3). It causes shared context metadata to be
43
+ # inherited by the metadata hash of host groups and examples, rather than
44
+ # triggering implicit auto-inclusion in groups with matching metadata.
45
+ config.shared_context_metadata_behavior = :apply_to_host_groups
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # This allows you to limit a spec run to individual examples or groups
51
+ # you care about by tagging them with `:focus` metadata. When nothing
52
+ # is tagged with `:focus`, all examples get run. RSpec also provides
53
+ # aliases for `it`, `describe`, and `context` that include `:focus`
54
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
55
+ config.filter_run_when_matching :focus
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = "spec/examples.txt"
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
65
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
67
+ config.disable_monkey_patching!
68
+
69
+ # This setting enables warnings. It's recommended, but in some cases may
70
+ # be too noisy due to issues in dependencies.
71
+ config.warnings = true
72
+
73
+ # Many RSpec users commonly either run the entire suite or an individual
74
+ # file, and it's useful to allow more verbose output when running an
75
+ # individual spec file.
76
+ if config.files_to_run.one?
77
+ # Use the documentation formatter for detailed output,
78
+ # unless a formatter has already been configured
79
+ # (e.g. via a command-line flag).
80
+ config.default_formatter = "doc"
81
+ end
82
+
83
+ # Print the 10 slowest examples and example groups at the
84
+ # end of the spec run, to help surface which specs are running
85
+ # particularly slow.
86
+ config.profile_examples = 10
87
+
88
+ # Run specs in random order to surface order dependencies. If you find an
89
+ # order dependency and want to debug it, you can fix the order by providing
90
+ # the seed, which is printed after each run.
91
+ # --seed 1234
92
+ config.order = :random
93
+
94
+ # Seed global randomization in this process using the `--seed` CLI option.
95
+ # Setting this allows you to use `--seed` to deterministically reproduce
96
+ # test failures related to randomization by passing the same `--seed` value
97
+ # as the one that triggered the failure.
98
+ Kernel.srand config.seed
99
+ =end
100
+ end
@@ -0,0 +1,13 @@
1
+ require "open3"
2
+ require "#{ENV['HOME']}/.ruby_learner/workshop/lib/workplace.rb"
3
+
4
+ RSpec.describe "STDIN-check" do
5
+ it 'given [3, 6, 9], return "3\n6\n9\n[3, 6, 9]\n"' do
6
+ allow(STDIN).to receive(:readlines) { [3, 6, 9] }
7
+ expect { standard_input() }.to output("3\n6\n9\n[3, 6, 9]\n").to_stdout
8
+ end
9
+ it 'given ["fizz", "buzz"], return "fizz\nbuzz\n[\"fizz\\n\", \"buzz\\n\"]\n"' do
10
+ allow(STDIN).to receive(:readlines) { ["fizz\n", "buzz\n"] }
11
+ expect { standard_input() }.to output("fizz\nbuzz\n[\"fizz\\n\", \"buzz\\n\"]\n").to_stdout
12
+ end
13
+ 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.1.13
4
+ version: 1.1.14
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-02 00:00:00.000000000 Z
11
+ date: 2018-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -199,6 +199,11 @@ files:
199
199
  - questions/sequential_check/section_3/part_1/lib/workplace.rb
200
200
  - questions/sequential_check/section_3/part_1/spec/spec_helper.rb
201
201
  - questions/sequential_check/section_3/part_1/spec/workplace_spec.rb
202
+ - questions/sequential_check/section_3/part_2/lib/answer.rb
203
+ - questions/sequential_check/section_3/part_2/lib/sentence.org
204
+ - questions/sequential_check/section_3/part_2/lib/workplace.rb
205
+ - questions/sequential_check/section_3/part_2/spec/spec_helper.rb
206
+ - questions/sequential_check/section_3/part_2/spec/workplace_spec.rb
202
207
  - questions/sequential_check/section_4/part_1/lib/answer.rb
203
208
  - questions/sequential_check/section_4/part_1/lib/sentence.org
204
209
  - questions/sequential_check/section_4/part_1/lib/workplace.rb