ruby_learner 1.1.15 → 1.2.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/Gemfile.lock +1 -1
- data/{workshop → contents/datas}/emacs.d/black/answer.el +6 -6
- data/{workshop → contents/datas}/emacs.d/black/init.el +6 -6
- data/{workshop → contents/datas}/emacs.d/inits/line-num.el +0 -0
- data/{workshop → contents/datas}/emacs.d/markdown-mode/markdown-mode.el +0 -0
- data/{workshop → contents/datas}/emacs.d/ruby-mode/inf-ruby.el +0 -0
- data/{workshop → contents/datas}/emacs.d/ruby-mode/rdoc-mode.el +0 -0
- data/{workshop → contents/datas}/emacs.d/ruby-mode/ruby-electric.el +0 -0
- data/{workshop → contents/datas}/emacs.d/ruby-mode/ruby-mode.el +0 -0
- data/{workshop → contents/datas}/emacs.d/ruby-mode/ruby-style.el +0 -0
- data/{workshop → contents/datas}/emacs.d/ruby-mode/rubydb2x.el +0 -0
- data/{workshop → contents/datas}/emacs.d/ruby-mode/rubydb3x.el +0 -0
- data/{workshop → contents/datas}/emacs.d/themes/dracula-theme.el +0 -0
- data/{workshop → contents/datas}/emacs.d/themes/iceberg-theme.el +0 -0
- data/{workshop → contents/datas}/emacs.d/themes/my-misterioso-theme.el +0 -0
- data/{workshop → contents/datas}/emacs.d/themes/my-whiteboard-theme.el +0 -0
- data/{workshop → contents/datas}/emacs.d/themes/my-wombat-theme.el +0 -0
- data/{workshop → contents/datas}/emacs.d/white/answer.el +6 -6
- data/{workshop → contents/datas}/emacs.d/white/init.el +6 -6
- data/{lib → contents}/datas/emacs_help.org +0 -0
- data/contents/datas/emacs_help.pdf +0 -0
- data/{lib → contents}/datas/final_history_sequential.txt +0 -0
- data/{lib → contents}/datas/install_emacs.sh +0 -0
- data/{lib → contents}/datas/theme_color.txt +0 -0
- data/{questions → contents/questions}/random_check/.rspec +0 -0
- data/{questions → contents/questions}/random_check/random_h.rb +0 -0
- data/{questions → contents/questions}/random_check/section_1/.rspec +0 -0
- data/{questions → contents/questions}/random_check/section_1/lib/answer.rb +0 -0
- data/{questions → contents/questions}/random_check/section_1/lib/sentence.org +0 -0
- data/{questions → contents/questions}/random_check/section_1/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/random_check/section_1/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/random_check/section_1/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/random_check/section_2/.rspec +0 -0
- data/{questions → contents/questions}/random_check/section_2/lib/answer.rb +0 -0
- data/{questions → contents/questions}/random_check/section_2/lib/sentence.org +0 -0
- data/{questions → contents/questions}/random_check/section_2/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/random_check/section_2/spec/.rspec +0 -0
- data/{questions → contents/questions}/random_check/section_2/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/random_check/section_2/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_1/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_1/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_1/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_1/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_1/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_2/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_2/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_2/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_2/spec/.rspec +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_2/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_2/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_3/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_3/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_3/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_3/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_1/part_3/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_10/part_1/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_10/part_1/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_10/part_1/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_10/part_1/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_10/part_1/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_10/part_2/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_10/part_2/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_10/part_2/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_10/part_2/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_10/part_2/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_11/part_1/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_11/part_1/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_11/part_1/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_11/part_1/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_11/part_1/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_11/part_2/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_11/part_2/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_11/part_2/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_11/part_2/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_11/part_2/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_1/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_1/lib/sentence.org +16 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_1/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_1/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_1/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_2/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_2/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_2/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_2/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_2/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_3/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_3/lib/sentence.org +1 -1
- data/{questions → contents/questions}/sequential_check/section_2/part_3/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_3/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_2/part_3/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_1/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_1/lib/sentence.org +14 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_1/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_1/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_1/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_2/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_2/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_2/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_2/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_2/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_3/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_3/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_3/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_3/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_3/part_3/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_1/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_1/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_1/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_1/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_1/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_2/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_2/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_2/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_2/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_2/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_3/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_3/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_3/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_3/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_4/part_3/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_1/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_1/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_1/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_1/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_1/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_2/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_2/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_2/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_2/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_2/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_3/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_3/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_3/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_3/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_5/part_3/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_1/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_1/lib/sentence.org +1 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_1/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_1/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_1/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_2/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_2/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_2/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_2/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_2/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_3/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_3/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_3/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_3/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_3/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_4/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_4/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_4/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_4/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_6/part_4/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_7/part_1/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_7/part_1/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_7/part_1/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_7/part_1/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_7/part_1/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_7/part_2/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_7/part_2/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_7/part_2/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_7/part_2/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_7/part_2/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_8/part_1/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_8/part_1/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_8/part_1/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_8/part_1/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_8/part_1/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_1/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_1/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_1/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_1/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_1/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_2/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_2/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_2/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_2/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_2/spec/workplace_spec.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_3/lib/answer.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_3/lib/sentence.org +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_3/lib/workplace.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_3/spec/spec_helper.rb +0 -0
- data/{questions → contents/questions}/sequential_check/section_9/part_3/spec/workplace_spec.rb +0 -0
- data/{workshop → contents}/restore/empty.rb +0 -0
- data/{takahashi → contents/takahashi}/docs/README.org +0 -0
- data/{takahashi → contents/takahashi}/docs/drill.html +0 -0
- data/{takahashi → contents/takahashi}/docs/drill.org +0 -0
- data/{takahashi → contents/takahashi}/docs/ruby_for_beginner.html +0 -0
- data/{takahashi → contents/takahashi}/docs/ruby_for_beginner.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/10_1.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/10_2.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/11_1.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/11_2.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/1_1.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/1_2.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/1_3.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/2_1.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/2_2.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/3_1.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/4_1.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/5_1.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/5_2.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/6_1.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/6_2.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/6_3.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/6_4.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/7_1.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/7_2.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/8_1.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/9_1.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/9_2.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/9_3.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/answer/hello.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/final_check/cut_nisen.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/final_check/get_nisen.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/final_check/nisendouka.html +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/final_check/nisendouka.txt +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/final_check/simple_match.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/final_check/simple_match2.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/final_check/simple_match3.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/final_check/simple_match4.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/final_check/test.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/final_check/test_2.rb +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/10_1.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/10_2.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/11_1.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/11_2.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/1_1.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/1_2.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/1_3.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/2_1.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/2_2.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/3_1.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/4_1.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/5_1.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/5_2.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/6_1.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/6_2.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/6_3.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/6_4.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/7_1.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/7_2.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/8_1.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/9_1.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/9_2.org +0 -0
- data/{takahashi → contents/takahashi}/sample_prog/question/9_3.org +0 -0
- data/{workshop → contents/workshop}/lib/answer.rb +0 -0
- data/{workshop → contents/workshop}/lib/for-def-read.rb +0 -0
- data/{workshop → contents/workshop}/lib/for-read.txt +0 -0
- data/{workshop → contents/workshop}/lib/sentence.org +0 -0
- data/{workshop → contents/workshop}/lib/workplace.rb +0 -0
- data/{workshop → contents/workshop}/rspec +0 -0
- data/{workshop → contents/workshop}/rubocop.yml +0 -0
- data/{workshop → contents/workshop}/spec/spec_helper.rb +0 -0
- data/{workshop → contents/workshop}/spec/workplace_spec.rb +0 -0
- data/lib/ruby_learner/common.rb +21 -22
- data/lib/ruby_learner/ruby_learner.rb +51 -16
- data/lib/ruby_learner/sequential_main.rb +39 -19
- data/lib/ruby_learner/typing_practice.rb +8 -5
- data/lib/ruby_learner/version.rb +1 -1
- metadata +258 -261
- data/takahashi/docs/README.org~ +0 -148
- data/takahashi/docs/drill.html~ +0 -861
- data/takahashi/sample_prog/answer/1_1.rb~ +0 -1
- data/takahashi/sample_prog/answer/9_2.rb~ +0 -5
data/takahashi/docs/README.org~
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
* 卒業研究
|
|
3
|
-
|
|
4
|
-
** Thema
|
|
5
|
-
editor_learner を基にした Ruby 習熟プログラム ruby_learner(仮) 開発
|
|
6
|
-
|
|
7
|
-
CUI ベースで動作するプログラム ruby の基本的な動作、規則、記法などを習得
|
|
8
|
-
|
|
9
|
-
** 研究方針?
|
|
10
|
-
editor_learner の目的は emacs 上でのtype操作の習熟
|
|
11
|
-
ruby_learner(仮)の目的は ruby の習熟->一週間でrubyが扱える!
|
|
12
|
-
|
|
13
|
-
# 「ruby の習熟」の定義?
|
|
14
|
-
# 何を以って「ruby を習得した」とみなす?
|
|
15
|
-
|
|
16
|
-
たのしいRuby第5版を’実行しながら’読み込み、思ったことを全て羅列
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
** 評価形式
|
|
21
|
-
# editor_learner は時間計測により習熟度を評価
|
|
22
|
-
# ruby_learner(仮)の評価形式は?
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
2018/7/25
|
|
27
|
-
|
|
28
|
-
** 結局何をするのか
|
|
29
|
-
|
|
30
|
-
Ruby習熟のための問題作成。
|
|
31
|
-
|
|
32
|
-
問題形式
|
|
33
|
-
|
|
34
|
-
・出題に対する回答となるプログラムの記述
|
|
35
|
-
・
|
|
36
|
-
|
|
37
|
-
*** 大津君との連携
|
|
38
|
-
|
|
39
|
-
私のやること
|
|
40
|
-
|
|
41
|
-
・Ruby習熟のための問題作成
|
|
42
|
-
・出題システム構成
|
|
43
|
-
|
|
44
|
-
大津君のやること
|
|
45
|
-
|
|
46
|
-
・”問題”の添削システム構成
|
|
47
|
-
・rspecのtestを作成(red-green-refactaringのred-greenの部分)
|
|
48
|
-
・abc_size_check機能(green-refactaringの部分)の実装
|
|
49
|
-
|
|
50
|
-
** ゼミ
|
|
51
|
-
|
|
52
|
-
githubでRuby_learnerのプロジェクトを立ち上げ
|
|
53
|
-
|
|
54
|
-
以後進捗等適宜
|
|
55
|
-
|
|
56
|
-
丸写しのテキストではなく、
|
|
57
|
-
レジュメにすること。じぶんの「独自の」まとめを書く
|
|
58
|
-
|
|
59
|
-
org-html-themes
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Ruby勉強ドリルを作るんだよ
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
**
|
|
67
|
-
コードはテスト
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
ruby_learner 起動方法
|
|
71
|
-
1. rake build
|
|
72
|
-
2. rake install:local
|
|
73
|
-
3. ruby_learner [COMMAND]
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
** 8/1 ゼミ
|
|
77
|
-
|
|
78
|
-
「たのしいRuby1章の内容を完璧にできるプログラムの完成」
|
|
79
|
-
|
|
80
|
-
見栄えの良いドリル(見辛い参考書で勉強する奴はいない
|
|
81
|
-
|
|
82
|
-
たのしいRUbyはなぜ見栄えがいいのか?
|
|
83
|
-
(少なくとも自分は読んでそう感じたはずで、ならばその理由があるはず
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
文章校正
|
|
87
|
-
|
|
88
|
-
rubocop
|
|
89
|
-
|
|
90
|
-
それができてから次のことー>応用、発展の習熟
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
言語の修得
|
|
94
|
-
・テキスト
|
|
95
|
-
・リファレンス・マニュアル
|
|
96
|
-
ー文法、関数の使い方等(必要な時に参照
|
|
97
|
-
・逆引き
|
|
98
|
-
ー何かをしたいー>どう書くか
|
|
99
|
-
・問題集
|
|
100
|
-
|
|
101
|
-
たのしいRuby第5版に、「Rake」「正規表現」を用いた応用が含まれるか?
|
|
102
|
-
含まれていないなら、第3版23章を参考にする
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
** 8/4
|
|
106
|
-
|
|
107
|
-
-番号はたのしいRuby準拠の仮置きなので、あとで入れ替えます
|
|
108
|
-
|
|
109
|
-
-8_1 8_2は2_1より前に持ってくるかも
|
|
110
|
-
|
|
111
|
-
-2_1.rbのrubocopの添削について
|
|
112
|
-
|
|
113
|
-
#+begin
|
|
114
|
-
> rubocop answer/2_1.rb
|
|
115
|
-
Inspecting 1 file
|
|
116
|
-
C
|
|
117
|
-
|
|
118
|
-
Offenses:
|
|
119
|
-
|
|
120
|
-
answer/2_1.rb:1:1: C: Style/Encoding: Unnecessary utf-8 encoding comment.
|
|
121
|
-
# -*- coding: utf-8 -*-
|
|
122
|
-
^^^^^^^^^^^^^^^^^^^^^^^
|
|
123
|
-
|
|
124
|
-
1 file inspected, 1 offense detected
|
|
125
|
-
#+end
|
|
126
|
-
|
|
127
|
-
文字コードの記述、rubocopは必要無いと言うけどemacsだと勝手に記述されてしまう
|
|
128
|
-
解答例のコードに日本語入れない方が良い?
|
|
129
|
-
|
|
130
|
-
-4_1.rbと4_2.rbは順番入れ替えます
|
|
131
|
-
|
|
132
|
-
-8_2.rb 計算するためにint型に変換する必要あったので、別に変数用意して出力
|
|
133
|
-
|
|
134
|
-
-9_3.rb else使わないならif使わない方がいいって意味なんだろうけど、代わりに何使うのか分からない
|
|
135
|
-
|
|
136
|
-
*** 他入れておきたい問題
|
|
137
|
-
|
|
138
|
-
-ARGVで受け取った文字列を数値に変換して表示するプログラム
|
|
139
|
-
-正規表現を上手い具合に問題に落とし込みたい
|
|
140
|
-
|
|
141
|
-
** 8/13
|
|
142
|
-
|
|
143
|
-
問題文作成
|
|
144
|
-
|
|
145
|
-
応用問題としてrakeを使うって話があったはず
|
|
146
|
-
たのしいRuby掲載のrake関係の頁は正直本を読み込まないと理解できないレベルのコードが書いてある
|
|
147
|
-
|
|
148
|
-
どうしましょ
|
data/takahashi/docs/drill.html~
DELETED
|
@@ -1,861 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" lang="jp" xml:lang="jp">
|
|
5
|
-
<head>
|
|
6
|
-
<title>はじめてのRuby</title>
|
|
7
|
-
<!-- 2018-08-09 木 17:09 -->
|
|
8
|
-
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
|
9
|
-
<meta name="generator" content="Org-mode" />
|
|
10
|
-
<meta name="author" content="Shun Takahashi" />
|
|
11
|
-
<style type="text/css">
|
|
12
|
-
<!--/*--><![CDATA[/*><!--*/
|
|
13
|
-
.title { text-align: center; }
|
|
14
|
-
.todo { font-family: monospace; color: red; }
|
|
15
|
-
.done { color: green; }
|
|
16
|
-
.tag { background-color: #eee; font-family: monospace;
|
|
17
|
-
padding: 2px; font-size: 80%; font-weight: normal; }
|
|
18
|
-
.timestamp { color: #bebebe; }
|
|
19
|
-
.timestamp-kwd { color: #5f9ea0; }
|
|
20
|
-
.right { margin-left: auto; margin-right: 0px; text-align: right; }
|
|
21
|
-
.left { margin-left: 0px; margin-right: auto; text-align: left; }
|
|
22
|
-
.center { margin-left: auto; margin-right: auto; text-align: center; }
|
|
23
|
-
.underline { text-decoration: underline; }
|
|
24
|
-
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
|
|
25
|
-
p.verse { margin-left: 3%; }
|
|
26
|
-
pre {
|
|
27
|
-
border: 1px solid #ccc;
|
|
28
|
-
box-shadow: 3px 3px 3px #eee;
|
|
29
|
-
padding: 8pt;
|
|
30
|
-
font-family: monospace;
|
|
31
|
-
overflow: auto;
|
|
32
|
-
margin: 1.2em;
|
|
33
|
-
}
|
|
34
|
-
pre.src {
|
|
35
|
-
position: relative;
|
|
36
|
-
overflow: visible;
|
|
37
|
-
padding-top: 1.2em;
|
|
38
|
-
}
|
|
39
|
-
pre.src:before {
|
|
40
|
-
display: none;
|
|
41
|
-
position: absolute;
|
|
42
|
-
background-color: white;
|
|
43
|
-
top: -10px;
|
|
44
|
-
right: 10px;
|
|
45
|
-
padding: 3px;
|
|
46
|
-
border: 1px solid black;
|
|
47
|
-
}
|
|
48
|
-
pre.src:hover:before { display: inline;}
|
|
49
|
-
pre.src-sh:before { content: 'sh'; }
|
|
50
|
-
pre.src-bash:before { content: 'sh'; }
|
|
51
|
-
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
|
|
52
|
-
pre.src-R:before { content: 'R'; }
|
|
53
|
-
pre.src-perl:before { content: 'Perl'; }
|
|
54
|
-
pre.src-java:before { content: 'Java'; }
|
|
55
|
-
pre.src-sql:before { content: 'SQL'; }
|
|
56
|
-
|
|
57
|
-
table { border-collapse:collapse; }
|
|
58
|
-
caption.t-above { caption-side: top; }
|
|
59
|
-
caption.t-bottom { caption-side: bottom; }
|
|
60
|
-
td, th { vertical-align:top; }
|
|
61
|
-
th.right { text-align: center; }
|
|
62
|
-
th.left { text-align: center; }
|
|
63
|
-
th.center { text-align: center; }
|
|
64
|
-
td.right { text-align: right; }
|
|
65
|
-
td.left { text-align: left; }
|
|
66
|
-
td.center { text-align: center; }
|
|
67
|
-
dt { font-weight: bold; }
|
|
68
|
-
.footpara:nth-child(2) { display: inline; }
|
|
69
|
-
.footpara { display: block; }
|
|
70
|
-
.footdef { margin-bottom: 1em; }
|
|
71
|
-
.figure { padding: 1em; }
|
|
72
|
-
.figure p { text-align: center; }
|
|
73
|
-
.inlinetask {
|
|
74
|
-
padding: 10px;
|
|
75
|
-
border: 2px solid gray;
|
|
76
|
-
margin: 10px;
|
|
77
|
-
background: #ffffcc;
|
|
78
|
-
}
|
|
79
|
-
#org-div-home-and-up
|
|
80
|
-
{ text-align: right; font-size: 70%; white-space: nowrap; }
|
|
81
|
-
textarea { overflow-x: auto; }
|
|
82
|
-
.linenr { font-size: smaller }
|
|
83
|
-
.code-highlighted { background-color: #ffff00; }
|
|
84
|
-
.org-info-js_info-navigation { border-style: none; }
|
|
85
|
-
#org-info-js_console-label
|
|
86
|
-
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
|
|
87
|
-
.org-info-js_search-highlight
|
|
88
|
-
{ background-color: #ffff00; color: #000000; font-weight: bold; }
|
|
89
|
-
/*]]>*/-->
|
|
90
|
-
</style>
|
|
91
|
-
<link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/htmlize.css"/>
|
|
92
|
-
<link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/readtheorg.css"/>
|
|
93
|
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
|
94
|
-
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
|
95
|
-
<script type="text/javascript" src="http://www.pirilampo.org/styles/lib/js/jquery.stickytableheaders.js"></script>
|
|
96
|
-
<script type="text/javascript" src="http://www.pirilampo.org/styles/readtheorg/js/readtheorg.js"></script>
|
|
97
|
-
<script type="text/javascript">
|
|
98
|
-
/*
|
|
99
|
-
@licstart The following is the entire license notice for the
|
|
100
|
-
JavaScript code in this tag.
|
|
101
|
-
|
|
102
|
-
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
|
103
|
-
|
|
104
|
-
The JavaScript code in this tag is free software: you can
|
|
105
|
-
redistribute it and/or modify it under the terms of the GNU
|
|
106
|
-
General Public License (GNU GPL) as published by the Free Software
|
|
107
|
-
Foundation, either version 3 of the License, or (at your option)
|
|
108
|
-
any later version. The code is distributed WITHOUT ANY WARRANTY;
|
|
109
|
-
without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
110
|
-
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
|
111
|
-
|
|
112
|
-
As additional permission under GNU GPL version 3 section 7, you
|
|
113
|
-
may distribute non-source (e.g., minimized or compacted) forms of
|
|
114
|
-
that code without the copy of the GNU GPL normally required by
|
|
115
|
-
section 4, provided you include this license notice and a URL
|
|
116
|
-
through which recipients can access the Corresponding Source.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
@licend The above is the entire license notice
|
|
120
|
-
for the JavaScript code in this tag.
|
|
121
|
-
*/
|
|
122
|
-
<!--/*--><![CDATA[/*><!--*/
|
|
123
|
-
function CodeHighlightOn(elem, id)
|
|
124
|
-
{
|
|
125
|
-
var target = document.getElementById(id);
|
|
126
|
-
if(null != target) {
|
|
127
|
-
elem.cacheClassElem = elem.className;
|
|
128
|
-
elem.cacheClassTarget = target.className;
|
|
129
|
-
target.className = "code-highlighted";
|
|
130
|
-
elem.className = "code-highlighted";
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
function CodeHighlightOff(elem, id)
|
|
134
|
-
{
|
|
135
|
-
var target = document.getElementById(id);
|
|
136
|
-
if(elem.cacheClassElem)
|
|
137
|
-
elem.className = elem.cacheClassElem;
|
|
138
|
-
if(elem.cacheClassTarget)
|
|
139
|
-
target.className = elem.cacheClassTarget;
|
|
140
|
-
}
|
|
141
|
-
/*]]>*///-->
|
|
142
|
-
</script>
|
|
143
|
-
<script type="text/javascript" src="http://orgmode.org/mathjax/MathJax.js"></script>
|
|
144
|
-
<script type="text/javascript">
|
|
145
|
-
<!--/*--><![CDATA[/*><!--*/
|
|
146
|
-
MathJax.Hub.Config({
|
|
147
|
-
// Only one of the two following lines, depending on user settings
|
|
148
|
-
// First allows browser-native MathML display, second forces HTML/CSS
|
|
149
|
-
// config: ["MMLorHTML.js"], jax: ["input/TeX"],
|
|
150
|
-
jax: ["input/TeX", "output/HTML-CSS"],
|
|
151
|
-
extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js",
|
|
152
|
-
"TeX/noUndefined.js"],
|
|
153
|
-
tex2jax: {
|
|
154
|
-
inlineMath: [ ["\\(","\\)"] ],
|
|
155
|
-
displayMath: [ ['$$','$$'], ["\\[","\\]"], ["\\begin{displaymath}","\\end{displaymath}"] ],
|
|
156
|
-
skipTags: ["script","noscript","style","textarea","pre","code"],
|
|
157
|
-
ignoreClass: "tex2jax_ignore",
|
|
158
|
-
processEscapes: false,
|
|
159
|
-
processEnvironments: true,
|
|
160
|
-
preview: "TeX"
|
|
161
|
-
},
|
|
162
|
-
showProcessingMessages: true,
|
|
163
|
-
displayAlign: "center",
|
|
164
|
-
displayIndent: "2em",
|
|
165
|
-
|
|
166
|
-
"HTML-CSS": {
|
|
167
|
-
scale: 100,
|
|
168
|
-
availableFonts: ["STIX","TeX"],
|
|
169
|
-
preferredFont: "TeX",
|
|
170
|
-
webFont: "TeX",
|
|
171
|
-
imageFont: "TeX",
|
|
172
|
-
showMathMenu: true,
|
|
173
|
-
},
|
|
174
|
-
MMLorHTML: {
|
|
175
|
-
prefer: {
|
|
176
|
-
MSIE: "MML",
|
|
177
|
-
Firefox: "MML",
|
|
178
|
-
Opera: "HTML",
|
|
179
|
-
other: "HTML"
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
/*]]>*///-->
|
|
184
|
-
</script>
|
|
185
|
-
</head>
|
|
186
|
-
<body>
|
|
187
|
-
<div id="content">
|
|
188
|
-
<h1 class="title">はじめてのRuby</h1>
|
|
189
|
-
<div id="table-of-contents">
|
|
190
|
-
<h2>Table of Contents</h2>
|
|
191
|
-
<div id="text-table-of-contents">
|
|
192
|
-
<ul>
|
|
193
|
-
<li><a href="#sec-1">1. print,puts,pメソッド</a>
|
|
194
|
-
<ul>
|
|
195
|
-
<li><a href="#sec-1-1">1.1. helloruby.rb</a></li>
|
|
196
|
-
<li><a href="#sec-1-2">1.2. helloruby_2.rb</a></li>
|
|
197
|
-
<li><a href="#sec-1-3">1.3. p_method.rb</a></li>
|
|
198
|
-
<li><a href="#sec-1-4">1.4. kiritsubo.rb</a></li>
|
|
199
|
-
</ul>
|
|
200
|
-
</li>
|
|
201
|
-
<li><a href="#sec-2">2. コマンドラインからのデータの入力</a>
|
|
202
|
-
<ul>
|
|
203
|
-
<li><a href="#sec-2-1">2.1. print_argv.rb</a></li>
|
|
204
|
-
<li><a href="#sec-2-2">2.2. arg_arith.rb</a></li>
|
|
205
|
-
</ul>
|
|
206
|
-
</li>
|
|
207
|
-
<li><a href="#sec-3">3. 変数</a>
|
|
208
|
-
<ul>
|
|
209
|
-
<li><a href="#sec-3-1">3.1. area_volume.rb</a></li>
|
|
210
|
-
</ul>
|
|
211
|
-
</li>
|
|
212
|
-
<li><a href="#sec-4">4. 条件判断</a>
|
|
213
|
-
<ul>
|
|
214
|
-
<li><a href="#sec-4-1">4.1. greater_smaller_else.rb</a></li>
|
|
215
|
-
</ul>
|
|
216
|
-
</li>
|
|
217
|
-
<li><a href="#sec-5">5. 繰り返し</a>
|
|
218
|
-
<ul>
|
|
219
|
-
<li><a href="#sec-5-1">5.1. 1_to_n.rb</a></li>
|
|
220
|
-
<li><a href="#sec-5-2">5.2. five_times.rb</a></li>
|
|
221
|
-
</ul>
|
|
222
|
-
</li>
|
|
223
|
-
<li><a href="#sec-6">6. 配列</a>
|
|
224
|
-
<ul>
|
|
225
|
-
<li><a href="#sec-6-1">6.1. 配列からオブジェクトを取り出す</a></li>
|
|
226
|
-
<li><a href="#sec-6-2">6.2. 配列にオブジェクトを格納する</a></li>
|
|
227
|
-
<li><a href="#sec-6-3">6.3. 配列の大きさ</a></li>
|
|
228
|
-
<li><a href="#sec-6-4">6.4. 配列と繰り返し</a></li>
|
|
229
|
-
</ul>
|
|
230
|
-
</li>
|
|
231
|
-
<li><a href="#sec-7">7. ハッシュ</a>
|
|
232
|
-
<ul>
|
|
233
|
-
<li><a href="#sec-7-1">7.1. シンボル</a></li>
|
|
234
|
-
<li><a href="#sec-7-2">7.2. ハッシュの操作</a></li>
|
|
235
|
-
</ul>
|
|
236
|
-
</li>
|
|
237
|
-
<li><a href="#sec-8">8. 正規表現</a>
|
|
238
|
-
<ul>
|
|
239
|
-
<li><a href="#sec-8-1">8.1. パターンとマッチング</a></li>
|
|
240
|
-
</ul>
|
|
241
|
-
</li>
|
|
242
|
-
<li><a href="#sec-9">9. ファイルからの読み込み</a>
|
|
243
|
-
<ul>
|
|
244
|
-
<li><a href="#sec-9-1">9.1. read_text.rb</a></li>
|
|
245
|
-
<li><a href="#sec-9-2">9.2. read_line.rb</a></li>
|
|
246
|
-
<li><a href="#sec-9-3">9.3. simple_grep.rb</a></li>
|
|
247
|
-
</ul>
|
|
248
|
-
</li>
|
|
249
|
-
<li><a href="#sec-10">10. メソッドの作成</a>
|
|
250
|
-
<ul>
|
|
251
|
-
<li><a href="#sec-10-1">10.1. hello_ruby2.rb</a></li>
|
|
252
|
-
</ul>
|
|
253
|
-
</li>
|
|
254
|
-
<li><a href="#sec-11">11. 別のファイルを取り込む</a>
|
|
255
|
-
<ul>
|
|
256
|
-
<li><a href="#sec-11-1">11.1. ディレクトリ内のファイルの取り込み</a></li>
|
|
257
|
-
<li><a href="#sec-11-2">11.2. Rubyの標準ライブラリ</a></li>
|
|
258
|
-
</ul>
|
|
259
|
-
</li>
|
|
260
|
-
</ul>
|
|
261
|
-
</div>
|
|
262
|
-
</div>
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
<div id="outline-container-sec-1" class="outline-2">
|
|
266
|
-
<h2 id="sec-1"><span class="section-number-2">1</span> print,puts,pメソッド</h2>
|
|
267
|
-
<div class="outline-text-2" id="text-1">
|
|
268
|
-
</div><div id="outline-container-sec-1-1" class="outline-3">
|
|
269
|
-
<h3 id="sec-1-1"><span class="section-number-3">1.1</span> helloruby.rb</h3>
|
|
270
|
-
<div class="outline-text-3" id="text-1-1">
|
|
271
|
-
<p>
|
|
272
|
-
「Hello, Ruby.」という文字列を出力するプログラムを作成せよ
|
|
273
|
-
</p>
|
|
274
|
-
|
|
275
|
-
<div class="org-src-container">
|
|
276
|
-
|
|
277
|
-
<pre class="src src-ruby">print 'Hello, Ruby.\n'
|
|
278
|
-
</pre>
|
|
279
|
-
</div>
|
|
280
|
-
|
|
281
|
-
<pre class="example">
|
|
282
|
-
> answer.rb
|
|
283
|
-
Hello, Ruby.
|
|
284
|
-
</pre>
|
|
285
|
-
</div>
|
|
286
|
-
</div>
|
|
287
|
-
|
|
288
|
-
<div id="outline-container-sec-1-2" class="outline-3">
|
|
289
|
-
<h3 id="sec-1-2"><span class="section-number-3">1.2</span> helloruby_2.rb</h3>
|
|
290
|
-
<div class="outline-text-3" id="text-1-2">
|
|
291
|
-
<p>
|
|
292
|
-
「Hello, "Ruby".」という文字列を出力するプログラムを作成せよ
|
|
293
|
-
</p>
|
|
294
|
-
|
|
295
|
-
<div class="org-src-container">
|
|
296
|
-
|
|
297
|
-
<pre class="src src-ruby">print Hello, \"Ruby\".\n"
|
|
298
|
-
</pre>
|
|
299
|
-
</div>
|
|
300
|
-
|
|
301
|
-
<pre class="example">
|
|
302
|
-
> answer.rb
|
|
303
|
-
Hello, "Ruby".
|
|
304
|
-
</pre>
|
|
305
|
-
</div>
|
|
306
|
-
</div>
|
|
307
|
-
|
|
308
|
-
<div id="outline-container-sec-1-3" class="outline-3">
|
|
309
|
-
<h3 id="sec-1-3"><span class="section-number-3">1.3</span> p_method.rb</h3>
|
|
310
|
-
<div class="outline-text-3" id="text-1-3">
|
|
311
|
-
<p>
|
|
312
|
-
「"Hello,\n\tRuby."」という文字列を出力するプログラムを作成せよ
|
|
313
|
-
</p>
|
|
314
|
-
|
|
315
|
-
<div class="org-src-container">
|
|
316
|
-
|
|
317
|
-
<pre class="src src-ruby">p "Hello,\n\tRuby."
|
|
318
|
-
</pre>
|
|
319
|
-
</div>
|
|
320
|
-
|
|
321
|
-
<pre class="example">
|
|
322
|
-
> answer.rb
|
|
323
|
-
"Hello,\n\tRuby."
|
|
324
|
-
</pre>
|
|
325
|
-
</div>
|
|
326
|
-
</div>
|
|
327
|
-
|
|
328
|
-
<div id="outline-container-sec-1-4" class="outline-3">
|
|
329
|
-
<h3 id="sec-1-4"><span class="section-number-3">1.4</span> kiritsubo.rb</h3>
|
|
330
|
-
<div class="outline-text-3" id="text-1-4">
|
|
331
|
-
</div>
|
|
332
|
-
</div>
|
|
333
|
-
</div>
|
|
334
|
-
|
|
335
|
-
<div id="outline-container-sec-2" class="outline-2">
|
|
336
|
-
<h2 id="sec-2"><span class="section-number-2">2</span> コマンドラインからのデータの入力</h2>
|
|
337
|
-
<div class="outline-text-2" id="text-2">
|
|
338
|
-
</div><div id="outline-container-sec-2-1" class="outline-3">
|
|
339
|
-
<h3 id="sec-2-1"><span class="section-number-3">2.1</span> print_argv.rb</h3>
|
|
340
|
-
<div class="outline-text-3" id="text-2-1">
|
|
341
|
-
<p>
|
|
342
|
-
コマンドラインから引数を5つ入力として受け取り、出力するプログラム
|
|
343
|
-
</p>
|
|
344
|
-
|
|
345
|
-
<div class="org-src-container">
|
|
346
|
-
|
|
347
|
-
<pre class="src src-ruby">puts ARGV[0]
|
|
348
|
-
puts ARGV[1]
|
|
349
|
-
puts ARGV[2]
|
|
350
|
-
puts ARGV[3]
|
|
351
|
-
puts ARGV[4]
|
|
352
|
-
</pre>
|
|
353
|
-
</div>
|
|
354
|
-
|
|
355
|
-
<pre class="example">
|
|
356
|
-
> ruby answer.rb 1st 2nd 3rd 4th 5th
|
|
357
|
-
1st
|
|
358
|
-
2nd
|
|
359
|
-
3rd
|
|
360
|
-
4th
|
|
361
|
-
5th
|
|
362
|
-
</pre>
|
|
363
|
-
</div>
|
|
364
|
-
</div>
|
|
365
|
-
|
|
366
|
-
<div id="outline-container-sec-2-2" class="outline-3">
|
|
367
|
-
<h3 id="sec-2-2"><span class="section-number-3">2.2</span> arg_arith.rb</h3>
|
|
368
|
-
<div class="outline-text-3" id="text-2-2">
|
|
369
|
-
<p>
|
|
370
|
-
コマンドラインから数値を2つ受け取り、和、差、積、商を表示するプログラム
|
|
371
|
-
</p>
|
|
372
|
-
|
|
373
|
-
<div class="org-src-container">
|
|
374
|
-
|
|
375
|
-
<pre class="src src-ruby">num0 = ARGV[0].to_i
|
|
376
|
-
num1 = ARGV[1].to_i
|
|
377
|
-
|
|
378
|
-
sum = num0 + num1
|
|
379
|
-
dif = num0 - num1
|
|
380
|
-
pro = num0 * num1
|
|
381
|
-
quo = num0 / num1
|
|
382
|
-
|
|
383
|
-
puts sum
|
|
384
|
-
puts dif
|
|
385
|
-
puts pro
|
|
386
|
-
puts quo
|
|
387
|
-
</pre>
|
|
388
|
-
</div>
|
|
389
|
-
|
|
390
|
-
<pre class="example">
|
|
391
|
-
> ruby answer.rb 5 3
|
|
392
|
-
8
|
|
393
|
-
2
|
|
394
|
-
15
|
|
395
|
-
1
|
|
396
|
-
</pre>
|
|
397
|
-
</div>
|
|
398
|
-
</div>
|
|
399
|
-
</div>
|
|
400
|
-
|
|
401
|
-
<div id="outline-container-sec-3" class="outline-2">
|
|
402
|
-
<h2 id="sec-3"><span class="section-number-2">3</span> 変数</h2>
|
|
403
|
-
<div class="outline-text-2" id="text-3">
|
|
404
|
-
</div><div id="outline-container-sec-3-1" class="outline-3">
|
|
405
|
-
<h3 id="sec-3-1"><span class="section-number-3">3.1</span> area_volume.rb</h3>
|
|
406
|
-
<div class="outline-text-3" id="text-3-1">
|
|
407
|
-
<p>
|
|
408
|
-
3つの数値x、y、zを受け取り、縦x、横y、高さzの直方体の表面積と体積を求めるプログラム
|
|
409
|
-
</p>
|
|
410
|
-
|
|
411
|
-
<div class="org-src-container">
|
|
412
|
-
|
|
413
|
-
<pre class="src src-ruby">x = ARGV[0].to_i
|
|
414
|
-
y = ARGV[1].to_i
|
|
415
|
-
z = ARGV[2].to_i
|
|
416
|
-
|
|
417
|
-
area = (x * y + y * z + z * x) * 2
|
|
418
|
-
volume = x * y * z
|
|
419
|
-
|
|
420
|
-
print '表面積=', area, "\n"
|
|
421
|
-
print '体積=' volume, "\n"
|
|
422
|
-
</pre>
|
|
423
|
-
</div>
|
|
424
|
-
|
|
425
|
-
<pre class="example">
|
|
426
|
-
> ruby answer.rb 10 20 30
|
|
427
|
-
表面積=2200
|
|
428
|
-
体積=6000
|
|
429
|
-
</pre>
|
|
430
|
-
</div>
|
|
431
|
-
</div>
|
|
432
|
-
</div>
|
|
433
|
-
|
|
434
|
-
<div id="outline-container-sec-4" class="outline-2">
|
|
435
|
-
<h2 id="sec-4"><span class="section-number-2">4</span> 条件判断</h2>
|
|
436
|
-
<div class="outline-text-2" id="text-4">
|
|
437
|
-
</div><div id="outline-container-sec-4-1" class="outline-3">
|
|
438
|
-
<h3 id="sec-4-1"><span class="section-number-3">4.1</span> greater_smaller_else.rb</h3>
|
|
439
|
-
<div class="outline-text-3" id="text-4-1">
|
|
440
|
-
<p>
|
|
441
|
-
数値を1つ引数として受け取り、それが10より大きければ「greater」小さければ「smaller」と表示するプログラム
|
|
442
|
-
</p>
|
|
443
|
-
|
|
444
|
-
<div class="org-src-container">
|
|
445
|
-
|
|
446
|
-
<pre class="src src-ruby">a = ARGV[0].to_i
|
|
447
|
-
|
|
448
|
-
if a >= 10
|
|
449
|
-
print "greater\n"
|
|
450
|
-
else
|
|
451
|
-
print "smaller\n"
|
|
452
|
-
end
|
|
453
|
-
</pre>
|
|
454
|
-
</div>
|
|
455
|
-
|
|
456
|
-
<pre class="example">
|
|
457
|
-
>ruby answer.rb 20
|
|
458
|
-
greater
|
|
459
|
-
|
|
460
|
-
>ruby answer.rb 5
|
|
461
|
-
smaller
|
|
462
|
-
</pre>
|
|
463
|
-
</div>
|
|
464
|
-
</div>
|
|
465
|
-
</div>
|
|
466
|
-
|
|
467
|
-
<div id="outline-container-sec-5" class="outline-2">
|
|
468
|
-
<h2 id="sec-5"><span class="section-number-2">5</span> 繰り返し</h2>
|
|
469
|
-
<div class="outline-text-2" id="text-5">
|
|
470
|
-
</div><div id="outline-container-sec-5-1" class="outline-3">
|
|
471
|
-
<h3 id="sec-5-1"><span class="section-number-3">5.1</span> 1_to_n.rb</h3>
|
|
472
|
-
<div class="outline-text-3" id="text-5-1">
|
|
473
|
-
<p>
|
|
474
|
-
入力された1つの数値nを引数として受け取り、1からnまでの数を順番に表示するプログラムを作成せよ
|
|
475
|
-
</p>
|
|
476
|
-
|
|
477
|
-
<div class="org-src-container">
|
|
478
|
-
|
|
479
|
-
<pre class="src src-ruby">n = ARGV[0].to_i
|
|
480
|
-
i = 1
|
|
481
|
-
while i <= n
|
|
482
|
-
print i, "\n"
|
|
483
|
-
i += 1
|
|
484
|
-
end
|
|
485
|
-
</pre>
|
|
486
|
-
</div>
|
|
487
|
-
|
|
488
|
-
<pre class="example">
|
|
489
|
-
> ruby answer.rb 5
|
|
490
|
-
1
|
|
491
|
-
2
|
|
492
|
-
3
|
|
493
|
-
4
|
|
494
|
-
5
|
|
495
|
-
</pre>
|
|
496
|
-
</div>
|
|
497
|
-
</div>
|
|
498
|
-
|
|
499
|
-
<div id="outline-container-sec-5-2" class="outline-3">
|
|
500
|
-
<h3 id="sec-5-2"><span class="section-number-3">5.2</span> five_times.rb</h3>
|
|
501
|
-
<div class="outline-text-3" id="text-5-2">
|
|
502
|
-
<p>
|
|
503
|
-
「All work and no play makes Jack a dull boy.」と5行表示するプログラム
|
|
504
|
-
</p>
|
|
505
|
-
|
|
506
|
-
<div class="org-src-container">
|
|
507
|
-
|
|
508
|
-
<pre class="src src-ruby">5.times do
|
|
509
|
-
print "All work and no play makes Jack a dull boy.\n"
|
|
510
|
-
end
|
|
511
|
-
</pre>
|
|
512
|
-
</div>
|
|
513
|
-
|
|
514
|
-
<pre class="example">
|
|
515
|
-
> answer.rb
|
|
516
|
-
All work and no play makes Jack a dull boy.
|
|
517
|
-
All work and no play makes Jack a dull boy.
|
|
518
|
-
All work and no play makes Jack a dull boy.
|
|
519
|
-
All work and no play makes Jack a dull boy.
|
|
520
|
-
All work and no play makes Jack a dull boy.
|
|
521
|
-
</pre>
|
|
522
|
-
</div>
|
|
523
|
-
</div>
|
|
524
|
-
</div>
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
<div id="outline-container-sec-6" class="outline-2">
|
|
528
|
-
<h2 id="sec-6"><span class="section-number-2">6</span> 配列</h2>
|
|
529
|
-
<div class="outline-text-2" id="text-6">
|
|
530
|
-
</div><div id="outline-container-sec-6-1" class="outline-3">
|
|
531
|
-
<h3 id="sec-6-1"><span class="section-number-3">6.1</span> 配列からオブジェクトを取り出す</h3>
|
|
532
|
-
<div class="outline-text-3" id="text-6-1">
|
|
533
|
-
<p>
|
|
534
|
-
配列のn番目の要素を取り出し、表示するプログラム.ただし、配列には数値が入るものとする。
|
|
535
|
-
</p>
|
|
536
|
-
|
|
537
|
-
<div class="org-src-container">
|
|
538
|
-
|
|
539
|
-
<pre class="src src-ruby">nums = [3, 1, 4, 1, 5]
|
|
540
|
-
|
|
541
|
-
print nums[ARGV[0].to_i]
|
|
542
|
-
</pre>
|
|
543
|
-
</div>
|
|
544
|
-
|
|
545
|
-
<div class="org-src-container">
|
|
546
|
-
|
|
547
|
-
<pre class="src src-ruby">> ruby answer.rb 0
|
|
548
|
-
3
|
|
549
|
-
|
|
550
|
-
> ruby answer.rb 3
|
|
551
|
-
1
|
|
552
|
-
</pre>
|
|
553
|
-
</div>
|
|
554
|
-
</div>
|
|
555
|
-
</div>
|
|
556
|
-
|
|
557
|
-
<div id="outline-container-sec-6-2" class="outline-3">
|
|
558
|
-
<h3 id="sec-6-2"><span class="section-number-3">6.2</span> 配列にオブジェクトを格納する</h3>
|
|
559
|
-
<div class="outline-text-3" id="text-6-2">
|
|
560
|
-
<p>
|
|
561
|
-
配列の先頭の要素をコマンドラインに入力した要素に変更するプログラム
|
|
562
|
-
</p>
|
|
563
|
-
|
|
564
|
-
<div class="org-src-container">
|
|
565
|
-
|
|
566
|
-
<pre class="src src-ruby">nums = [3, 1, 4, 1, 5]
|
|
567
|
-
|
|
568
|
-
nums[0] = ARGV[0].to_i
|
|
569
|
-
|
|
570
|
-
print nums
|
|
571
|
-
</pre>
|
|
572
|
-
</div>
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
<pre class="example">
|
|
576
|
-
> ruby answer.rb 5
|
|
577
|
-
[5, 1, 4, 1, 5]
|
|
578
|
-
</pre>
|
|
579
|
-
</div>
|
|
580
|
-
</div>
|
|
581
|
-
|
|
582
|
-
<div id="outline-container-sec-6-3" class="outline-3">
|
|
583
|
-
<h3 id="sec-6-3"><span class="section-number-3">6.3</span> 配列の大きさ</h3>
|
|
584
|
-
<div class="outline-text-3" id="text-6-3">
|
|
585
|
-
<p>
|
|
586
|
-
配列を表示し、その配列の大きさも表示するプログラムを作成せよ
|
|
587
|
-
</p>
|
|
588
|
-
|
|
589
|
-
<div class="org-src-container">
|
|
590
|
-
|
|
591
|
-
<pre class="src src-ruby">names =
|
|
592
|
-
|
|
593
|
-
print names, "\n"
|
|
594
|
-
|
|
595
|
-
print names.size
|
|
596
|
-
</pre>
|
|
597
|
-
</div>
|
|
598
|
-
</div>
|
|
599
|
-
</div>
|
|
600
|
-
|
|
601
|
-
<div id="outline-container-sec-6-4" class="outline-3">
|
|
602
|
-
<h3 id="sec-6-4"><span class="section-number-3">6.4</span> 配列と繰り返し</h3>
|
|
603
|
-
<div class="outline-text-3" id="text-6-4">
|
|
604
|
-
<p>
|
|
605
|
-
配列全体を表示してから、配列の要素を順に表示するプログラム
|
|
606
|
-
</p>
|
|
607
|
-
|
|
608
|
-
<div class="org-src-container">
|
|
609
|
-
|
|
610
|
-
<pre class="src src-ruby">names = ["小林", "林", "高野", "森岡"]
|
|
611
|
-
|
|
612
|
-
print names, "\n"
|
|
613
|
-
|
|
614
|
-
names.each do |n|
|
|
615
|
-
puts n
|
|
616
|
-
end
|
|
617
|
-
</pre>
|
|
618
|
-
</div>
|
|
619
|
-
|
|
620
|
-
<pre class="example">
|
|
621
|
-
> ruby answer.rb
|
|
622
|
-
["小林", "林", "高野", "森岡"]
|
|
623
|
-
小林
|
|
624
|
-
林
|
|
625
|
-
高野
|
|
626
|
-
森岡
|
|
627
|
-
</pre>
|
|
628
|
-
</div>
|
|
629
|
-
</div>
|
|
630
|
-
</div>
|
|
631
|
-
|
|
632
|
-
<div id="outline-container-sec-7" class="outline-2">
|
|
633
|
-
<h2 id="sec-7"><span class="section-number-2">7</span> ハッシュ</h2>
|
|
634
|
-
<div class="outline-text-2" id="text-7">
|
|
635
|
-
</div><div id="outline-container-sec-7-1" class="outline-3">
|
|
636
|
-
<h3 id="sec-7-1"><span class="section-number-3">7.1</span> シンボル</h3>
|
|
637
|
-
<div class="outline-text-3" id="text-7-1">
|
|
638
|
-
<p>
|
|
639
|
-
コマンドラインから文字列を受け取り、シンボルに変換して表示するプログラム
|
|
640
|
-
</p>
|
|
641
|
-
|
|
642
|
-
<div class="org-src-container">
|
|
643
|
-
|
|
644
|
-
<pre class="src src-ruby">n = ARGV[0]
|
|
645
|
-
|
|
646
|
-
p n.to_sym
|
|
647
|
-
</pre>
|
|
648
|
-
</div>
|
|
649
|
-
|
|
650
|
-
<pre class="example">
|
|
651
|
-
> ruby answer.rb hash
|
|
652
|
-
:hash
|
|
653
|
-
</pre>
|
|
654
|
-
</div>
|
|
655
|
-
</div>
|
|
656
|
-
|
|
657
|
-
<div id="outline-container-sec-7-2" class="outline-3">
|
|
658
|
-
<h3 id="sec-7-2"><span class="section-number-3">7.2</span> ハッシュの操作</h3>
|
|
659
|
-
<div class="outline-text-3" id="text-7-2">
|
|
660
|
-
<p>
|
|
661
|
-
:name, :furiganaというそれぞれのキーに"高橋", "タカハシ"というオブジェクトが格納されているハッシュを表示、さらに:telというキーに"000-1234-5678"を格納して再度表示するプログラム
|
|
662
|
-
</p>
|
|
663
|
-
|
|
664
|
-
<div class="org-src-container">
|
|
665
|
-
|
|
666
|
-
<pre class="src src-ruby">address = {name: "高橋", furigana: "タカハシ"}
|
|
667
|
-
|
|
668
|
-
puts address
|
|
669
|
-
|
|
670
|
-
address[:tel] = "000-1234-5678"
|
|
671
|
-
|
|
672
|
-
puts address
|
|
673
|
-
</pre>
|
|
674
|
-
</div>
|
|
675
|
-
|
|
676
|
-
<pre class="example">
|
|
677
|
-
> ruby answer.rb
|
|
678
|
-
{:name=>"高橋", :furigana=>"タカハシ"}
|
|
679
|
-
{:name=>"高橋", :furigana=>"タカハシ", :tel=>"000-1234-5678"}
|
|
680
|
-
</pre>
|
|
681
|
-
</div>
|
|
682
|
-
</div>
|
|
683
|
-
</div>
|
|
684
|
-
|
|
685
|
-
<div id="outline-container-sec-8" class="outline-2">
|
|
686
|
-
<h2 id="sec-8"><span class="section-number-2">8</span> 正規表現</h2>
|
|
687
|
-
<div class="outline-text-2" id="text-8">
|
|
688
|
-
</div><div id="outline-container-sec-8-1" class="outline-3">
|
|
689
|
-
<h3 id="sec-8-1"><span class="section-number-3">8.1</span> パターンとマッチング</h3>
|
|
690
|
-
<div class="outline-text-3" id="text-8-1">
|
|
691
|
-
<div class="org-src-container">
|
|
692
|
-
|
|
693
|
-
<pre class="src src-ruby"></pre>
|
|
694
|
-
</div>
|
|
695
|
-
</div>
|
|
696
|
-
</div>
|
|
697
|
-
</div>
|
|
698
|
-
|
|
699
|
-
<div id="outline-container-sec-9" class="outline-2">
|
|
700
|
-
<h2 id="sec-9"><span class="section-number-2">9</span> ファイルからの読み込み</h2>
|
|
701
|
-
<div class="outline-text-2" id="text-9">
|
|
702
|
-
</div><div id="outline-container-sec-9-1" class="outline-3">
|
|
703
|
-
<h3 id="sec-9-1"><span class="section-number-3">9.1</span> read_text.rb</h3>
|
|
704
|
-
<div class="outline-text-3" id="text-9-1">
|
|
705
|
-
<p>
|
|
706
|
-
コマンドラインからファイル名を受け取り、該当ファイルのテキストデータを表示するプログラム
|
|
707
|
-
</p>
|
|
708
|
-
|
|
709
|
-
<div class="org-src-container">
|
|
710
|
-
|
|
711
|
-
<pre class="src src-ruby">filename = ARGV[0]
|
|
712
|
-
text = File.read(filename)
|
|
713
|
-
print text
|
|
714
|
-
</pre>
|
|
715
|
-
</div>
|
|
716
|
-
|
|
717
|
-
<pre class="example">
|
|
718
|
-
>ruby answer.rb [filename]
|
|
719
|
-
[text]
|
|
720
|
-
</pre>
|
|
721
|
-
</div>
|
|
722
|
-
</div>
|
|
723
|
-
|
|
724
|
-
<div id="outline-container-sec-9-2" class="outline-3">
|
|
725
|
-
<h3 id="sec-9-2"><span class="section-number-3">9.2</span> read_line.rb</h3>
|
|
726
|
-
<div class="outline-text-3" id="text-9-2">
|
|
727
|
-
<p>
|
|
728
|
-
コマンドラインからファイル名を受け取り、該当ファイルのテキストデータを1行ずつ表示すつプログラム
|
|
729
|
-
</p>
|
|
730
|
-
|
|
731
|
-
<div class="org-src-container">
|
|
732
|
-
|
|
733
|
-
<pre class="src src-ruby">filename = ARGV[0]
|
|
734
|
-
file = File.open(filename)
|
|
735
|
-
file.each_line do |line|
|
|
736
|
-
print line
|
|
737
|
-
end
|
|
738
|
-
</pre>
|
|
739
|
-
</div>
|
|
740
|
-
|
|
741
|
-
<pre class="example">
|
|
742
|
-
</pre>
|
|
743
|
-
</div>
|
|
744
|
-
</div>
|
|
745
|
-
|
|
746
|
-
<div id="outline-container-sec-9-3" class="outline-3">
|
|
747
|
-
<h3 id="sec-9-3"><span class="section-number-3">9.3</span> simple_grep.rb</h3>
|
|
748
|
-
<div class="outline-text-3" id="text-9-3">
|
|
749
|
-
<p>
|
|
750
|
-
入力したテキストデータの中から、正規表現で指定した特定のパターンにマッチする行を出力するプログラム
|
|
751
|
-
</p>
|
|
752
|
-
|
|
753
|
-
<div class="org-src-container">
|
|
754
|
-
|
|
755
|
-
<pre class="src src-ruby">pattern = Regexp.new(ARGV[0])
|
|
756
|
-
filename = ARGV[1]
|
|
757
|
-
|
|
758
|
-
file = File.open(filename)
|
|
759
|
-
file.each_line do |line|
|
|
760
|
-
if pattern =~ line
|
|
761
|
-
print line
|
|
762
|
-
end
|
|
763
|
-
end
|
|
764
|
-
file.close
|
|
765
|
-
</pre>
|
|
766
|
-
</div>
|
|
767
|
-
|
|
768
|
-
<pre class="example">
|
|
769
|
-
>ruby answer.rb [pattern] [filename]
|
|
770
|
-
</pre>
|
|
771
|
-
</div>
|
|
772
|
-
</div>
|
|
773
|
-
</div>
|
|
774
|
-
|
|
775
|
-
<div id="outline-container-sec-10" class="outline-2">
|
|
776
|
-
<h2 id="sec-10"><span class="section-number-2">10</span> メソッドの作成</h2>
|
|
777
|
-
<div class="outline-text-2" id="text-10">
|
|
778
|
-
</div><div id="outline-container-sec-10-1" class="outline-3">
|
|
779
|
-
<h3 id="sec-10-1"><span class="section-number-3">10.1</span> hello_ruby2.rb</h3>
|
|
780
|
-
<div class="outline-text-3" id="text-10-1">
|
|
781
|
-
<p>
|
|
782
|
-
「Hello, Ruby.」と表示するメソッドhelloを用いて、
|
|
783
|
-
</p>
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
<div class="org-src-container">
|
|
787
|
-
|
|
788
|
-
<pre class="src src-ruby">def hello
|
|
789
|
-
puts "Hello, Ruby."
|
|
790
|
-
end
|
|
791
|
-
|
|
792
|
-
hello()
|
|
793
|
-
</pre>
|
|
794
|
-
</div>
|
|
795
|
-
|
|
796
|
-
<pre class="example">
|
|
797
|
-
> ruby hello_ruby2.rb
|
|
798
|
-
Hello, Ruby.
|
|
799
|
-
</pre>
|
|
800
|
-
</div>
|
|
801
|
-
</div>
|
|
802
|
-
</div>
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
<div id="outline-container-sec-11" class="outline-2">
|
|
808
|
-
<h2 id="sec-11"><span class="section-number-2">11</span> 別のファイルを取り込む</h2>
|
|
809
|
-
<div class="outline-text-2" id="text-11">
|
|
810
|
-
</div><div id="outline-container-sec-11-1" class="outline-3">
|
|
811
|
-
<h3 id="sec-11-1"><span class="section-number-3">11.1</span> ディレクトリ内のファイルの取り込み</h3>
|
|
812
|
-
<div class="outline-text-3" id="text-11-1">
|
|
813
|
-
<div class="org-src-container">
|
|
814
|
-
|
|
815
|
-
<pre class="src src-ruby">def simple_grep(pattern, filename)
|
|
816
|
-
file = File.open(filename)
|
|
817
|
-
file.each_line do |line|
|
|
818
|
-
if pattern =~ line
|
|
819
|
-
print line
|
|
820
|
-
end
|
|
821
|
-
end
|
|
822
|
-
file.close
|
|
823
|
-
end
|
|
824
|
-
</pre>
|
|
825
|
-
</div>
|
|
826
|
-
|
|
827
|
-
<div class="org-src-container">
|
|
828
|
-
|
|
829
|
-
<pre class="src src-ruby">require_relative "grep"
|
|
830
|
-
|
|
831
|
-
pattern = Regexp.new(ARGV[0])
|
|
832
|
-
filename = ARGV[1]
|
|
833
|
-
simple_grep(pattern, filename)
|
|
834
|
-
</pre>
|
|
835
|
-
</div>
|
|
836
|
-
</div>
|
|
837
|
-
</div>
|
|
838
|
-
|
|
839
|
-
<div id="outline-container-sec-11-2" class="outline-3">
|
|
840
|
-
<h3 id="sec-11-2"><span class="section-number-3">11.2</span> Rubyの標準ライブラリ</h3>
|
|
841
|
-
<div class="outline-text-3" id="text-11-2">
|
|
842
|
-
<div class="org-src-container">
|
|
843
|
-
|
|
844
|
-
<pre class="src src-ruby">require "date"
|
|
845
|
-
|
|
846
|
-
days = Date.today - Date.new(1993, 2, 24)
|
|
847
|
-
puts(days.to_i)
|
|
848
|
-
</pre>
|
|
849
|
-
</div>
|
|
850
|
-
</div>
|
|
851
|
-
</div>
|
|
852
|
-
</div>
|
|
853
|
-
</div>
|
|
854
|
-
<div id="postamble" class="status">
|
|
855
|
-
<p class="author">Author: Shun Takahashi</p>
|
|
856
|
-
<p class="date">Created: 2018-08-09 木 17:09</p>
|
|
857
|
-
<p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 25.3.1 (<a href="http://orgmode.org">Org</a> mode 8.2.10)</p>
|
|
858
|
-
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
|
859
|
-
</div>
|
|
860
|
-
</body>
|
|
861
|
-
</html>
|