Slide 1

Slide 1 text

RubyΛઆ໌͢Δͷ͸ ೉͍͠ʢԾʣ ͱͪ͗Rubyձٞ08(2019/6/29) [email protected]

Slide 2

Slide 2 text

RubyΛઆ໌͢Δͷ͸ ೉͍͠ ͱͪ͗Rubyձٞ08(2019/6/29) [email protected] ʢϓϩάϥϜΛڭ͑Δ࣌ʹʣ

Slide 3

Slide 3 text

ͱ͜ΖͰͩΕʁ • HN sugamasao • PN ͕͢ΘΒ·͞ͷΓ • Rubyྺ 13೥͘Β͍(…!!) • Rails͸ͦΜͳʹಘҙͰ͸ͳ͍ • Rubyʹؔ͢ΔΛ͍͔ͭ͘✍͠·ͨ͠

Slide 4

Slide 4 text

ࣥචྺ 2013 ύʔϑΣΫτRuby(ڞஶ) 2014 WebΞϓϦΤϯδχΞཆ੒ಡຊ(ڞஶ) 2014 ύʔϑΣΫτRuby on Rails(ڞஶ) 2017 վఆ2൛ ύʔϑΣΫτRuby(ڞஶ) 2018 ͔ΜͨΜRuby(୯ஶ) 2019 ???

Slide 5

Slide 5 text

͔ΜͨΜRubyࣥචͷࡍʹ೉͠ ͍ͳʙͱࢥͬͨ෦෼ͱɺ࠷ऴత ʹͲ͏͍͏આ໌ʹͳ͔ͬͨΛղ આͯ͠ɺօ͞Μͷࠓޙͷࢀߟʹ ͳΔͱྑ͍ͳͱࢥ͍·͢ ͜͏͍͏આ໌Ͱ͏·͍ͬͨ͘Αʂͱ͍͏͓ ࿩Λ͓࣋ͪͷํ͸৭ʑڭ͍͑ͯͩ͘͞

Slide 6

Slide 6 text

͔ΜͨΜRuby ͱ͸ʁ

Slide 7

Slide 7 text

͔ΜͨΜRuby lຊॻ͸ɼʮ޿͘ɾਖ਼͘͠ɾ৽͘͠ʯΛ ίϯηϓτʹ3VCZͰϓϩάϥϛϯάΛ ͸͡ΊΔʹ౰ͨͬͯجຊతͳ͜ͱ͸͢΂ ֶͯशͰ͖Δ಺༰ͱͳ͍ͬͯ·͢ɻ ʢҎԼུʣz https://gihyo.jp/book/2018/978-4-7741- 9861-3 “͔ΜͨΜγϦʔζ”ͷRuby൛

Slide 8

Slide 8 text

͍ΘΏΔ ೖ໳ॻ

Slide 9

Slide 9 text

ࣥචςʔϚ • ଞͷݴޠͷ஌͕ࣝͳͯ͘΋Rubyͷجຊ͕Θ͔Δ • RubyͷϦϑΝϨϯεϚχϡΞϧΛಡΊΔΑ͏ʹͳΔ • ࣮ࡍʹ࢖ΘΕΔίʔυ͕Rubyͷίʔυͱͯ͠ಡΊΔ
 ʢ͋Δ͍͸ௐ΂ΒΕΔʣΑ͏ʹͳΔ

Slide 10

Slide 10 text

ଞͷݴޠͷ஌͕ࣝͳͯ͘΋ Rubyͷجຊ͕Θ͔Δ

Slide 11

Slide 11 text

ଞͷݴޠͷ஌͕ࣝͳͯ͘΋Rubyͷجຊ͕Θ͔Δ ·͋ೖ໳ॻͳͷͰɾɾɾ hogeݴޠͷ֓೦͸RubyͰݴ͏ͱ͜͏ͩΑʂ Ͱ͸ͳ͘ɺϓϩάϥϛϯάͱͯ͠ͷجຊΛ཈͑ ΒΕΔΑ͏ʹ : https://magazine.rubyist.net/articles/0001/0001-Hotlinks.html

Slide 12

Slide 12 text

RubyͷϦϑΝϨϯεϚχϡΞϧ ΛಡΊΔΑ͏ʹͳΔ

Slide 13

Slide 13 text

RubyͷϦϑΝϨϯεϚχϡΞϧΛಡΊΔΑ͏ʹͳΔ ͜ͷ఺͸ҟৗʹͩ͜Θ͍ͬͯͯɺຊॻͰ ղઆ͢Δͱ͖ϦϑΝϨϯεϚχϡΞϧͷ ϦϯΫΛ͚͍ͭͯΔ ʢϦϑΝϨϯεϚχϡΞϧͷಡΈํ͔Βղઆ͕͋Δκʣ ʢ૊ΈࠐΈϥΠϒϥϦͱඪ४ఴ෇ϥΠϒϥϦͱ͔͍ܰॳݟࡴ͠ ͩ͠……ʣ : ࡞ͬͯΈ͍ͨ΋ͷ͕ࢥ͍͍ͭͯ΋ௐ΂ํ͕Θ͔Βͳ͍ͱͲ͏ʹ΋ͳΒ ͳ͍ͷͰɺ࠷΋ॏཁͳ఺ͩͱߟ͍͑ͯ·͢

Slide 14

Slide 14 text

࣮ࡍʹ࢖ΘΕΔίʔυ͕ಡΊΔ

Slide 15

Slide 15 text

࣮ࡍʹ࢖ΘΕΔίʔυ͕ಡΊΔ ૉ๿ͳղઆʹऴ࢝ͯ͠͠·͏ͱɺ%ه๏ͷΑ͏ͳ આ໌༏ઌ౓ͱͯ͠͸௿͍ʢ͋Ε΋͜Ε΋ͱઆ໌͢Δͱ࿩͕ൃࢄ͠ ͪΌ͏ͷͰʣ͚Ͳ࣮ίʔυͰ͸;ͭ͏ʹग़ͯ͘ΔɺΈͨ ͍ͳ΋ͷ͸Ͳ͏ʹ͔ͯ͠ղઆ͍ͯ͋͛ͨ͠ ຊΛಡΜͰ͍Δ࣌఺Ͱ͖ͪΜͱཧղͰ͖ͳͯ͘΋ ʮ஌ͬͯʯ͍Ε͹ʮௐ΂ʯΒΕΔ͸ͣͳͷͰ

Slide 16

Slide 16 text

ͱ͜ΖͰ

Slide 17

Slide 17 text

ೖ໳ॻͱݴͬͯ΋ ର৅ಡऀϨϕϧʹΑͬͯ ੾Γޱ͸ҟͳΓ·͢

Slide 18

Slide 18 text

https://speakerdeck.com/igaiga/dive-into-code-rails-ruby-books?slide=10 @igaiga555͞ΜʹΑΔ࠷ۙͷॻ੶ͷ෼ྨ

Slide 19

Slide 19 text

͔ΜͨΜRuby͸ ʮଞݴޠܦݧ͋Γʯ ͷதͰ͸ϏΪφʔ޲͚

Slide 20

Slide 20 text

……ͱ͍͏Ϩϕϧײʹ͍ͭͯ ղઆΛ࡞͍ͬͯͨͷͰ͕͢ɺ ΑΓత֬ͳจষʹग़ձͬͨͷ ͰҾ༻͠·͢Ͷ

Slide 21

Slide 21 text

Matz͞ΜʹΑΔΦεεϝ https://jp.quora.com/ Ruby%E8%A8%80%E8%AA%9E%E3%82%92%E5%AD%A6%E3%81%B3%E5%A7%8B%E3%82%81%E3%82%8 B%E3%81%AE%E6%99%82%E3%81%AB%E4%B8%80%E7%95%AA%E3%82%AA%E3%82%B9%E3%82%B9% E3%83%A1%E3%81%AE%E6%9B%B8%E7%B1%8D%E3%81%AF%E3%81%A9%E3%82%8C ͍͢͝త֬!!!

Slide 22

Slide 22 text

ʢ౜ಥʣ RubyΛଞͷਓʹ ڭ͑Δͷͬͯ ೉͘͠ͳ͍Ͱ͔͢ʁ

Slide 23

Slide 23 text

ϜζΧγΠφʔͱ ࢥͬͨ͜ͱ͕͋Δਓ ʢ໰͍͕ࡶ͗͢·͢Ͷʣ

Slide 24

Slide 24 text

ͳΔ΄Ͳʙ

Slide 25

Slide 25 text

ຊ୊

Slide 26

Slide 26 text

࣍ͷίʔυΛݟͯ ࡞ऀͷؾ࣋ͪΛ ߟ͑Α ※కΊ੾ΓͷϓϨογϟʔ΍ࣥච͕πϥ͍ͳͲ͸ৗ࣌ ൃಈ͍ͯ͠ΔͷͰɺ͜͜Ͱ͸ߟ͑ͳ͍΋ͷͱ͢Δ

Slide 27

Slide 27 text

໰ Hello, world!ͷαϯϓϧίʔυΛ ղઆ͍ͨ͠ puts "Hello, world!"

Slide 28

Slide 28 text

࡞ऀͷߟ͑ hogeݴޠʹൺ΂ͯγϯϓϧʹॻ͚ΔΑʢͱݴ͍ ͍͕ͨΠϚυΩͦΕΛϝϦοτͱ͢Δ͔ʁʣ putsϝιουΛ࢖ͬͯจࣈྻΛग़ྗ͢ΔΑ Kernelʹఆ͍ٛͯ͠Δϝιουͩؔ͠਺෩ϝ ιουͬͯݴͬͨํ͕ྑ͔ͬͨΓ͢Δͷ͔ͳ ͦ΋ͦ΋Ϩγʔόͷͳ͍ϝιουӠʑͷઆ໌Α ͍΍͍΍ɺͦ΋ͦ΋putsϝιουͬͯԿͩΑ w w w w ࠓͷஈ֊Ͱͦ͜·Ͱݴ͏ඞཁͳ͍ɺৄࡉΛઆ໌ ͤͣʹ఻͑ͳ͍ͱͩ

Slide 29

Slide 29 text

ຊॻͷ౴͑ ͜͏ͳΔ P24

Slide 30

Slide 30 text

ຊॻΛॻ্͘Ͱ ߟ͍͑ͯͨॏཁ ͳϙΠϯτ✅

Slide 31

Slide 31 text

ղઆΛ͢Δ্Ͱ ՄೳͳݶΓ Ұͭͷ͜ͱΛઆ໌ ͍ͨ͠

Slide 32

Slide 32 text

͔͠͠ɺલఏ஌ࣝ ͷੵΈॏͶ΍΢ι ͷͳ͍γϯϓϧͳ આ໌Λ͢Δͷ͸ ͱͯ΋೰·͍͠

Slide 33

Slide 33 text

ྫ͑͹

Slide 34

Slide 34 text

Rubyʹؔ͢Δઆ໌Λ؆୯ͳ ಺༰͔Βॱংཱͯઆ໌͢Δ ͷ೉͍͠໰୊

Slide 35

Slide 35 text

Rubyʹؔ͢Δઆ໌Λॱংཱͯߟ͑Δ • ΠϯτϩμΫγϣϯ • จࣈྻ΍਺஋ʹ͍ͭͯͷղઆ • ੍ޚߏจʹ͍ͭͯ • ഑ྻʹ͍ͭͯ
 :

Slide 36

Slide 36 text

• ΠϯτϩμΫγϣϯ • จࣈྻ΍਺஋ʹ͍ͭͯͷղઆ • ੍ޚߏจʹ͍ͭͯ • ഑ྻʹ͍ͭͯ
 : Rubyʹؔ͢Δઆ໌Λॱংཱͯߟ͑Δ

Slide 37

Slide 37 text

puts "Hello, world!" puts 1 + 1
 puts "#{10 * 2}" ͜͜Βล͸ฏ࿨

Slide 38

Slide 38 text

puts "Hello, world!".upcase 3.times do |n| puts “=> #{n}” end ్୺ʹݫ͘͠ͳΔ

Slide 39

Slide 39 text

puts "Hello, world!".upcase 3.times do |n| puts “=> #{n}” end ్୺ʹݫ͘͠ͳΔ !? !? !? !?

Slide 40

Slide 40 text

• ϝιου • ʹΫϥεͷઆ໌͕ඞཁ • ϒϩοΫ • ϒϩοΫҾ਺ ్୺ʹݫ͘͠ͳΔ

Slide 41

Slide 41 text

͜ΕΒͷػೳΛ จࣈྻ΍਺஋ͷ͍ͭͰʹ આ໌͢ΔΘ͚ʹ͸͍͔ͳ͍

Slide 42

Slide 42 text

ಥવ͜ΕΒͷઆ໌Λ࢝ΊͨΒ “ύϧεͷϑΝϧγͷ ϧγ͕ίΫʔϯͰύʔδ” Έ͍ͨʹͳΔ

Slide 43

Slide 43 text

Ͱ͸Ͳ͏͢Δ͔

Slide 44

Slide 44 text

……

Slide 45

Slide 45 text

……

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

ʢૂ͍ͱͯ͠ʣΦϒδΣΫτࢦ޲ʹ ͍ͭͯղઆ͢Δͱ͍͏ΑΓ͸ ”ΦϒδΣΫτ”΍”ϝιου”ͳͲͷ ֓೦͕͋Δ͜ͱΛ஌͍ͬͯͯ΄͍͠

Slide 48

Slide 48 text

ʰ͜ͷੈքʱͰ͸ͦʔ͍͏΋ͷ ͩͱʰཧղʱͯ͠΋Β͏

Slide 49

Slide 49 text

Rubyʹؔ͢Δઆ໌Λ؆୯ͳ ಺༰͔Βॱংཱͯઆ໌͢Δ ͷ೉͍͠໰୊ ऴΘΓ

Slide 50

Slide 50 text

ϓϩάϥϜతͳҙຯͰΫϥε ͷઆ໌͕೉͍͠໰୊

Slide 51

Slide 51 text

ࣗ෼ͰΫϥεΛఆٛ͢Δ·Ͱ͸ ૉ๿ͳੈք ϩʔΧϧม਺Λ࢖͍ɺ૊ΈࠐΈϥΠϒϥϦͱ ༡ΜͰ฻Β͍͚ͯ͠Δ

Slide 52

Slide 52 text

Ϋϥεͷఆٛํ๏Λ஌Δͱಥવ ੈք͕։͚͗͢Δ໰୊

Slide 53

Slide 53 text

• Πϯελϯεม਺ • Ϋϥεม਺ • ϩʔΧϧม਺
 ʢࠓ·ͰԿؾͳ͘࢖͍ͬͯͨม਺ͷਖ਼ମʣ • self Ξοϓ࢝͠ΊΔม਺ͨͪ

Slide 54

Slide 54 text

• ΠϯελϯεԽ • Πϯελϯε/Ϋϥεϝιου • ϝιουͷՄࢹੑ • ΞΫηοαϝιου • ܧঝ • Etc Ϋϥεʹ·ͭΘΔػೳͨͪ

Slide 55

Slide 55 text

ͪΐͬͱઆ໌͢Δ͜ͱଟ͗͢΍ ͠ͳ͍͔Ͷʁ

Slide 56

Slide 56 text

Ͳ͏΍ͬͯઆ໌͢Δ͔ɺɺɺ

Slide 57

Slide 57 text

ɺɺɺ

Slide 58

Slide 58 text

ؤுͬͯઆ໌͢Δ͔͠ͳ͍

Slide 59

Slide 59 text

“ʮҰ൪ͷۙಓ͸ԕճΓͩͬͨʯ ʮԕճΓ͕ͦ͜Զͷ࠷୹ͷಓͩͬͨʯ” -δϟΠϩɾπΣϖϦ-

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

Ͳ͏ݟͯ΋͜ͷষ͚ͩେมͳϘ ϦϡʔϜͰ͢ɻຊ౰ʹ͋Γ͕ͱ ͏͍͟͝·ͨ͠

Slide 62

Slide 62 text

ϓϩάϥϜతͳҙຯͰΫϥεͷઆ ໌͕೉͍͠໰୊ ऴΘΓ

Slide 63

Slide 63 text

;ͭʔʹઆ໌͢Δͱऄ଍ͬΆ͘ͳ Δ͚ͲͲ͏ͯ͠΋આ໌͍ͨ͠ ʢͷͰઆ໌ͨ͠ʣػೳ/࢓૊Έ ͦͷଞ

Slide 64

Slide 64 text

จࣈίʔυ ࠓͷRuby͸σϑΥϧτΤϯίʔσΟϯά΋ UTF-8ͷ࣌୅ͳͷͰ;ͭ͏ʹ࢖͏෼ʹ͸ࠔΒͳ͍ ͔͠͠ɺCSV<->Excelͷѻ͍΍ૉ௚ʹ࡞ΒΕͨ Windows࢈ςΩετϑΝΠϧͳͲɺ༉அ͢Δͱ UTF-8Ҏ֎ͷ΋ͷʹग़ձ͏͜ͱ΋͋Δ

Slide 65

Slide 65 text

จࣈίʔυ

Slide 66

Slide 66 text

array.map(&:upcase)ͷΞϨ ϒϩοΫΛলུͯ͠&:methodΛ౉͢΍ʔͭ ਖ਼௚ɺೖ໳ॻͷϨϕϧײͱͯ͠͸ͪΌΜͱͨ͠ આ໌Λ͢Δʹ͸೉͍͠ʢ΍΍͍͜͠ʣ͚Ͳɺ ࣮ίʔυͰ͸;ͭ͏ʹ࢖ΘΕΔ΋ͷͳͷͰ આ໌͠ͳ͍Θ͚ʹ΋͍͘·͍

Slide 67

Slide 67 text

array.map(&:upcase)ͷΞϨ

Slide 68

Slide 68 text

;ͭ͏ʹࠔͬͨ࿩

Slide 69

Slide 69 text

γϯϘϧͷઆ໌ Ή͔ͣ͗͢͠Ο!!

Slide 70

Slide 70 text

จࣈྻΈ͍͚ͨͩͲจࣈྻ͡Ό ͳͯࣝ͘ผࢠʢࣝผࢠͱ͸ʣ తʹ࢖͏ΜͩΑɺΈ͍ͨͷΛͳ Μͱͳ͘Θ͔ͬͨؾʹͳΔΑ͏ ͳઆ໌Λ͠ͳͯ͘͸͍͚ͳ͍ͩ ͱʁʁʁ

Slide 71

Slide 71 text

ΨνͰࠔ͍ͬͯΔͷͰࡓ͑ͨઆ໌ ͷ࢓ํ͕͋Ε͹ڭ͍͑ͯͩ͘͞!!1

Slide 72

Slide 72 text

͓΋͠Ζ͔ͬͨΒ ྑ͍δϟϯʂͯ͠Ͷʂʢʁʁʁʣ ࠷ޙʹ ʮೖ໳ॻΛॻ͘ͷɺͲ͏ʹ͔ͳΔ΍Ζʯͱܰ͘ ߟ͍͑ͯͨΒࢮ͵΄ͲେมͰͨ͠ օ͞Μ΋ղઆͰۤ࿑ͨ͠఺΍޻෉͍ͯ͠Δ఺͕ ͋Ε͹ͥͻڭ͍͑ͯͩ͘͞☺

Slide 73

Slide 73 text

ࢀߟจݙ • ͔ΜͨΜRuby • https://gihyo.jp/book/2018/978-4-7741-9861-3 • θϩ͔ΒΘ͔Δ Ruby ௒ೖ໳ • https://gihyo.jp/book/2018/978-4-297-10123-7 • Ruby͓ΑͼRailsॻ੶ͷ෼ྨͱҰߟ࡯ • https://speakerdeck.com/igaiga/dive-into-code-rails-ruby-books • Rubyist Hotlinks ʲୈ 1 ճʳ ·ͭ΋ͱΏ͖ͻΖ͞Μ • https://magazine.rubyist.net/articles/0001/0001-Hotlinks.html • RubyϦϑΝϨϯεϚχϡΞϧ • https://docs.ruby-lang.org/ja/latest/doc/index.html

Slide 74

Slide 74 text

͕࣌ؒ༨ͬͨ༻ ॻ੶Λࣥච͢Δͱɺվϖʔδͷ౎߹Ͱ༨ന͕ଟ ͘ͳͬͯ͠·͏৔߹͕͋Γ·͢ ͜ͷΑ͏ͳ࣌ɺίϥϜͰຒΊͯ͘ΕʙͱݴΘΕ ΔͷͰίϥϜΛॻ͘ͷͰ͕͢ɺׂͱ޷͖উख͔ ָ͚͍ͯ͠Ͱ͢ ίϥϜͷதͰ͍͔͓ͭ͘ؾʹೖΓΛ঺հ͠·͢

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

͍ͬͯ͏͔ϓϩάϥϛ ϯάࣗମ͕Ή͔͍ͣ͠