はじめてのRuby 第9章 / Ruby Practice 09

Fd09da0d9751bb7875ef4ff7e6201860?s=47 muttan
November 15, 2016

はじめてのRuby 第9章 / Ruby Practice 09

Fd09da0d9751bb7875ef4ff7e6201860?s=128

muttan

November 15, 2016
Tweet

Transcript

  1. ͨͷ͍͠3VCZୈষ

  2. ͨͷ͍͠
 ₍₍ ง?@? ว⁾⁾

  3. 3VCZ

  4. ୈճ

  5. ୈষԋࢉࢠ

  6. ୅ೖԋࢉࢠ

  7. w 3VCZͷม਺͸ ͦͷ໊લͷม਺ʹ࠷ॳʹ୅ೖΛ ߦ͏λΠϛϯάͰ࡞੒͞ΕΔ w ʢ͓ͳ͡Έͷʣ ΍ ͷΑ͏ͳೋ߲ԋࢉ ࢠͱ୅ೖΛ૊Έ߹ΘͤͨԋࢉࢠΛ୅ೖԋࢉࢠͱ ͍͏

    ୅ೖԋࢉࢠ WBSPQWBM WBSWBSPQWBM
  8. ୅ೖԋࢉࢠͷྫ ԋࢉࢠ ҙຯ "# "ͱ#྆ํਅͳΒਅ "?# "903# "# "Λ#CJUࠨγϑτ "#

    "ͱ#ͷ࿦ཧੵ "c# "ͱ#ͷ࿦ཧ࿨
  9. ࿦ཧԋࢉࢠͷԠ༻

  10. w ࿦ཧԋࢉࢠΛ࢖ͬͨԋࢉʹ͸࣍ͷಛ௃͕͋Δ ᶃ ࠨଆͷ͔ࣜΒॱʹධՁ͞ΕΔ ᶄ ࿦ཧࣜͷਅِ͕ܾఆ͢Δͱ࢒Γͷࣜ͸ධՁ ͞Εͳ͍ ᶅ ࠷ޙʹධՁ͞Εͨࣜͷ஋͕࿦ཧࣜશମͷ஋ ͱͳΔ

    ࿦ཧԋࢉࢠͷԠ༻
  11. ᶃ ࠨଆͷ͔ࣜΒॱʹධՁ͞ΕΔ
 
 
 ͜ͷΑ͏ͳ͕ࣜ͋ͬͨͱ͖ ඞͣʮ৚݅ˠ৚݅ ʯͷॱ൪ͰධՁ͞ΕΔ
 ࿦ཧԋࢉࢠͷԠ༻ ৚݅cc৚݅

  12. ᶄ ࿦ཧࣜͷਅِ͕ܾఆ͢Δͱ ࢒Γͷࣜ͸ධՁ͞ Εͳ͍
 
 
 ͜ͷ৚݅ͷ৔߹ ৚͕݅ਅͰ͋Ε͹৚݅Λݟ Δ͜ͱͳ͘શମ͕ਅͰ͋Δ͜ͱ͸ࣗ໌Αͬͯ 

    ৚݅ͷΈධՁ͠৚݅͸ධՁ͠ͳ͍ ࿦ཧԋࢉࢠͷԠ༻ ৚݅cc৚݅
  13. w ৚ِ͕݅ͷ৔߹͸ࣜશମِ͕ͱͳΔͨΊ ৚݅ ِ͕ͷ৔߹͸ͦͷޙͷ৚݅ΛධՁ͠ͳ͍ w 3VCZͷ࿦ཧԋࢉࢠ͸ແବͳ৚݅ͷ൑ఆ͸ߦΘͳ ͍Α͏ʹͳ͍ͬͯΔ ࿦ཧԋࢉࢠͷԠ༻ ৚݅৚݅৚݅

  14. ᶅ ࠷ޙʹධՁ͞Εͨࣜͷ஋͕࿦ཧࣜશମͷ஋ͱͳ Δ
 
 
 ͜ͷࣜͰ͸ WBSͷਅِ͕൑ఆ͞Ε OJMPSGBMTF ͷͱ͖ͷΈz3VCZzͷਅِ͕൑அ͞ΕΔ ࿦ཧԋࢉࢠͷԠ༻

    WBSccl3VCZz
  15. w ࿦ཧԋࢉࢠ͸࣍ͷΑ͏ͳॲཧʹԠ༻Ͱ͖Δ
 ʢม਺OBNFʹԿΒ͔ͷ஋Λ༩͑Δॲཧʣ ࿦ཧԋࢉࢠͷԠ༻ OBNFl3VCZz JGWBS OBNFWBS FOE OBNFWBSccl3VCZz WBSʹ஋͕ઃఆ͞Ε͍ͯΕ͹

    WBS ͦ͏Ͱͳ͚Ε͹z3VCZz
  16. w ࿦ཧԋࢉࢠ͸࣍ͷΑ͏ͳॲཧʹԠ༻Ͱ͖Δ
 ʢ഑ྻͷઌ಄ཁૉΛऔΓग़͢ॲཧʣ
 
 
 
 
 
 
 ࿦ཧԋࢉࢠͷԠ༻

    JUFNOJM JGBSZ JUFNBSZpSTU FOE OBNFBSZBSZpSTU BSZ͕OJMPSGBMTFͰͳ͍࣌  BSZpSTUΛऔΓग़͢
  17. w ͜ͷૢ࡞͸ ʮΦϒδΣΫτϝιουʯͰॻ͘ ͜ͱ΋Ͱ͖ΔʢҎԼͷͭ͸౳Ձʣ
 
 w ͜ͷػೳ͸ ʮ҆શࢀরԋࢉࢠʯ΍ʮOJMνΣοΫ ෇͖ϝιουʯͱݺ͹ΕΔʢ3VCZҎ߱ʣ ࿦ཧԋࢉࢠͷԠ༻

    JUFNBSZBSZpSTU JUFNBSZpSTU
  18. w WBS͕OJMPSGBMTFͷ৔߹ͷΈΛ୅ೖ͢Δίʔυ w WBScc WBS ͱ౳ՁͰ͋Δ w ม਺ʹσϑΥϧτ஋Λ༩͑Δ৔߹ͷఆ൪ͷॻ͖ ํ ࿦ཧԋࢉࢠͷԠ༻

    WBScc
  19. ৚݅ԋࢉࢠ

  20. w ࡾ߲ԋࢉࢠͱ΋ݺ͹Ε͍ͯΔ
 w ͜ͷࣜ͸ ҎԼͷJGจͱಉ౳ͷҙຯΛ࣋ͭ ৚݅ԋࢉࢠ ৚݅ ࣜࣜ JG৚݅ ࣜ

    FMTF ࣜ FOE
  21. ൣғԋࢉࢠ

  22. w ஋ͷൣғΛද͢ΦϒδΣΫτʢGPSࣜ΍FBDIϝιο υͰ΋Ͱ͖ͯͨʣ
 
 w ʮʯΛൣғԋࢉࢠͱ͍͏ w ൣғԋࢉࢠ͸ೋछྨ͋Γ YZ͸<Y Z>Λද͠

    
 Yʜ͸<Y Z Λද͍ͯ͠Δ ൣғԋࢉࢠ 3BOHFOFX    লུܗ
  23. w 3BOHFΦϒδΣΫτ͸਺஋Ҏ֎ʹ΋ ݱࡏͷ஋͔ Β࣍ͷ஋Λ࡞ΔϝιουʢOFYUͳͲʣ͕͋Ε͹ ൣғͱͯ͠ࢦఆ͢Δ͜ͱ͕Ͱ͖Δ
 
 w 3BOHFΦϒδΣΫτ಺෦Ͱ͸ TVDDϝιουΛ ࣍ʑݺͿ͜ͱͰ͜ͷΑ͏ͳಈ࡞Λ࣮ݱ͍ͯ͠Δ

    ൣғԋࢉࢠ
  24. ԋࢉࢠͷ༏ઌॱҐ

  25. w ԋࢉࢠʹ͸༏ઌॱҐ͕ઃ͚ΒΕ͓ͯΓ ࣜதʹෳ ਺ͷԋࢉࢠ͕ଘࡏ͢Δ৔߹͸༏ઌ౓ͷߴ͍΋ͷ ͔Βॱʹݺͼग़͞ΕΔΧοίΛ෇͚Δͱ ͦͷ ৔ॴ͔ΒܭࢉΛߦ͏ ԋࢉࢠͷ༏ઌॱҐ ࣜ ҙຯ

    ݁Ռ         bB` bC`  bD` B`  bC`   bD` bBCCD             536& 1ਤԋࢉࢠͷ༏ઌॱҐࢀর
  26. ԋࢉࢠΛఆٛ͢Δ

  27. w 3VCZͷԋࢉࢠ͸Πϯελϯεϝιουͱͯ͠ఆ ٛ͞Ε͍ͯΔ w ҎԼͷԋࢉࢠΛআ͍ͯ ԋࢉࢠΛ࠶ఆٛ͢Δ͜ͱ ͕Ͱ͖Δ ԋࢉࢠΛఆٛ͢Δ  

    cc  ʜ  OPU ll BOE PS
  28. w ೋ߲ԋࢉࢠΛఆٛ͢Δʹ͸ ԋࢉࢠΛϝιου໊ ͱͯ͠ఆٛ͢Δ
 
 
 
 w ೋ߲ԋࢉࢠΛఆٛ͢Δ࣌͸ Ҿ਺໊ͱͯ͠

    ʮPUIFSʯ͕Α͘༻͍ΒΕΔ ೋ߲ԋࢉࢠ 1QPJOUSC࣮ߦ
  29. w ୯߲ԋࢉࢠΛఆٛ͢Δʹ͸ ʮԋࢉࢠ!ʯΛϝ ιου໊ͱͯ͠ఆٛ͢Δ
 
 
 
 ୯߲ԋࢉࢠ ࣗ෼ͷෳ੡

  30. w ഑ྻ΍ϋογϡͰ༻͍ΒΕΔPCK<J>ͱPCK<J>Yͷ ͜ͱΛఴࣈϝιουͱ͍͏ w ͜ΕΒͷϝιου͸ <>ͱ<>ͱ͍͏໊લͰఆٛՄ ೳͰ͋Δ w <> JOEFY

    <> JOEFY WBM ͱఆٛ͢ΔʢJOEFY͸ ఴࣈͷ൪߸ WBM͸୅ೖ͢Δ஋ʣ ఴࣈϝιου
  31. w ఴࣈϝιου࣮૷ྫ ఴࣈϝιου

  32. ࠓճͷ·ͱΊ

  33. ·ͱΊ w   ͷΑ͏ͳԋࢉࢠΛ୅ೖԋࢉࢠͱ͍͏ w ࿦ཧԋࢉࢠΛ׆༻͢Δ͜ͱͰ ৚݅ࣜ΍ॳظԽΛ ޮ཰తʹॻ͘͜ͱ͕Ͱ͖Δ w

    3BOHFΦϒδΣΫτ͸ൣғΛද͓ͯ͠Γ ൣғԋ ࢉࢠʮʯʮʜʯΛ༻͍Δ͜ͱͰੜ੒Ͱ͖Δ w Ұ෦ͷԋࢉࢠΛআ͍ͯ ԋࢉࢠΛ࠶ఆٛ͢Δ͜ͱ ͕Ͱ͖Δ