Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
A Practitioner's Journey from Ruby 1.8 to Present
Search
Koichi ITO
September 09, 2023
Programming
1
2k
A Practitioner's Journey from Ruby 1.8 to Present
大阪Ruby会議03 (
https://regional.rubykaigi.org/osaka03/
)
Koichi ITO
September 09, 2023
Tweet
Share
More Decks by Koichi ITO
See All by Koichi ITO
Beyond the RuboCop Defaults
koic
3
2.7k
Minify Ruby Code
koic
2
2.1k
Permanent Agility
koic
37
7.5k
RuboCop: LSP and Prism
koic
3
4.1k
Organizational Pattern Hatching
koic
0
1.5k
A Story Featuring Right Hand Archetype
koic
0
1.1k
Without Practice, No Emergence
koic
4
2.4k
The Resurrection of the Fast Parallel Test Runner
koic
1
6.2k
Software Craftsmanship against Nova Era
koic
0
1.6k
Other Decks in Programming
See All in Programming
Quine, Polyglot, 良いコード
qnighy
4
640
C++でシェーダを書く
fadis
6
4.1k
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
330
RubyLSPのマルチバイト文字対応
notfounds
0
120
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
280
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
140
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
初めてDefinitelyTypedにPRを出した話
syumai
0
400
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
190
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
427
64k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Speed Design
sergeychernyshev
24
610
Teambox: Starting and Learning
jrom
133
8.8k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Documentation Writing (for coders)
carmenintech
65
4.4k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Bash Introduction
62gerente
608
210k
The Cult of Friendly URLs
andyhume
78
6k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Transcript
,PJDIJ*50&4. *OD A Practitioner's Journey from Ruby 1.8 to Present
Have you been able to craft your job to be fun? େࡕ3VCZձٞ 4BU ϋʔτϯϗςϧ৺ࡈڮদ෩ϗʔϧ
@koic w044ϓϩάϥϚʔ w3VCP$PQίΞνʔϜ wגࣜձࣾӬγεςϜϚωδϝϯτ &4. *OD ΤϯδχΞϦϯάϚωʔδϟʔ݉ σΟεςΟϯάΠογϡυΤϯδχΞ
w ʰΦϒδΣΫτࢦεΫϦϓτݴޠ3VCZʱ ͕ڭຊɻʰσεΫτοϓϦϑΝϨϯεʱΛ ࣋ͪา͍ͯ௨ۈͯͨ͠ɻ 3VCZͱࢲ
None
େࡕ3VCZձٞͷ&4.ϝϯόʔ 4 Q FBLFS @junk0612 4 Q FBLFS @koic -5
@maimux2x 4 UB f @haruguchiyuma " UUFOEFF @fugakkbn " UUFOEFF @nsgc " UUFOEFF @kakutani ϑΣϩʔ
w ຊ3VCZΧϯϑΝϨϯε͔Βࠓͷ 3VCZ,BJHJ·Ͱͯ͢εϙϯαʔͯ͠Δ ੈք།Ұͷاۀ ެืͷͳ͍ আ͘ w 3VCZ,BJHJ
-5 -5 ొஃഐग़ w ຊࠃͰ34QFDͱ)BNMॳظͷಋೖاۀ 3VCZͱ&4. *OD
044ίϛϡχςΟͱͷڞੜΛࢧԉ 3BJMT044ύονձ #esm_oss
w !KVOL-SBNBίϯτϦϏϡʔλʔ w !4)QBSTFZίϯτϦϏϡʔλʔ w !LPJD1BSTFSHFNίϛολʔ w !JNB[VNJ*3#ίϛολʔ w !GVHBLLCO3#4ίϯτϦϏϡʔλʔ
ߏจղੳثݚڀ෦ IUUQTNBHB[JOFSVCZJTUOFUBSUJDMFT'PMMPX6Q,JSJTIJNB3VCZIUNM /&8
w3VCZͱΞδϟΠϧιϑτ ΣΞ։ൃΛ௨ͯ͡ίϛϡ χςΟͱ͍ͨ͠ਓ wຊશࠃ͔Βઈࢍืूத ΤϯδχΞืूத ͜Εɺωλ͡Όͳ͍Ͱ͔͢ΒͶʁ 🗾
3VCZ͔࣌Βݱࡏͷ࠷৽։ൃ൛Ͱ͋Δ 3VCZ·Ͱɺ3VCZͷόʔδϣϯΞοϓʹ ΑͬͯͲͷΑ͏ͳΠϕϯτ͕͋Γɺ࣌ͷ ࣄͰͷΞϓϦέʔγϣϯ։ൃ͋Δ͍044 ΤίγεςϜͰͲͷΑ͏ͳग़དྷࣄίʔυ ͷมֵ͕͔͋ͬͨԹނ৽Λ͓͠͠·͢ɻ ࠓͷ $'1ఏग़֓ཁΑΓ
ྺ࢙
#FGPSF3BJMT
w ຊ൪ϥϯλΠϜʹ3VCZ͕ೖ͍ͬͯͳ͍ w ։ൃڥͰ͋Ε3VCZΛΠϯείͰ͖Δ w +BWBͩͱෳछͷ+&&αʔόʔʹσϓϩΠ͢Δ &"3ϑΝΠϧͷBQQMJDBUJPOYNMͳΜ͔ͷ αʔόʔݻ༗9.-ଐੑͷฤूΛ3&9.-ͰࣗಈԽ
w 0ODF8SJUF3VO"OZXIFSFͷάϧʔݴޠ🤔 U%JBSZ͕ΩϥʔΞϓϦ࣌
0.(ʹ࠾ʁ !LLE IUUQPCKFDUDMVCKQNMBSDINBHB[JOFIUNM
"GUFS3BJMT
w 3BJMTͱ͍͏ࠇધ͕͖ͬͯͨ w ࣌3BJMTͷ࠾·ͩϦεΫ w 3BJMTొͷ࣌TDB ff PMEͰ·ͱͳΞϓϦ ࡞ΕΔͷٙʁͬͯΈͨΒશવͰ͖ͨ w
࣮ࡍͷͱ͜ΖTDB ff PME͏ػձ͕ͳ͍Α͏ͳ ͓ࣄͰ3VCZΛΩϝΔ࣌
w 3VCZPO3BJMTͰΓΓίʔυΛॻ͚ΔΑ ͏ʹͳͬͨΘΓʹΩϚΓ͗͢ͷΦʔόʔ ϫʔΫʹͳͬͯ͠·ͬͨࣄྫ͋Γ w ࣌ੜ࢈ੑഒͱݴΘΕ͍ͯͨཪ w 3VCZPO3BJMTͰఆ࣌ʹؼΖ͏"8%X3 Ωϝա͗ҙใ͕ग़Δ
w has_manyͳͲͰݴޠ%4-ͷڧྗ͞Λྲྀ w Ҿ࠷ޙͷϋογϡͷϒϨʔεͷলུͰ ΩʔϫʔυҾͬΆ͞ ࣌=>ه๏ͷΈ w 3BJMTͰಋೖ͞ΕͨSymbol#to_proc͕3VCZ
ʹϙʔςΟϯά͞ΕΔ 3BJMTʹΑΔ3VCZͷදݱྗ
͡·ΓͷSymbol#to_proc https://github.com/rails/rails/commit/69bf71f5e9b537f88acc0d4492a057336e7305d1
.FSHF:"37
w :"37͕ೖͬͯɺ"45ϕʔεͷධՁث͔ Β7.ʹΑΔόΠτίʔυ࣮ߦʹͳͬͨ w άϦʔϯεϨου͔ΒωΠςΟϒεϨουʹ ͳͬͨ (7-͕͋Δͷͷ*0ͪͳͲͷϒ ϩοΫதଞͷεϨου͕࣮ߦͰ͖Δ w
ͭ·ΓΞοϓάϨʔυ͢Δͱ͘ͳΔ࣌ ΞϓϦίʔυԼͰͷมԽ
w key => valueʹՃ͑key: valueͷ)BTIه๏ಋೖ w ྩ ࣌3VCZEFW ʹ
ʮ3VCZͷ)BTIه๏ʯͱίϝϯτ͢Δ͜ͱ͕ʂ w ΩʔϫʔυҾ͕ೖͬͨͷ3VCZ͔Β͕ͩɺϝιο υҾͷ࠷ޙͷϋογϡ͕ຊʹͦΕͬΆ͘ w ࣌ࢍ൱྆ͷlambdaͷ->ه๏͕ೖͬͨ w จࣈͱه߸ͷࣝผௐ͕ઈົ ΞϓϦίʔυ͕ݱతͳݟͨʹ
w 3VCZҎલͷจࣈྻόΠτͷγʔέϯε w ⤴Ͱଟ͘ͷEncoding::CompatibilityErrorͱରቂ w # encoding: UTF-8ϚδοΫίϝϯτʹΑΔ εΫϦϓτΤϯίʔσΟϯάͷࢦఆͱ
String#force_encodingͳͲʹΑΔετϦʔϜ ΤϯίʔσΟϯάมͰΓͬͨΑ͏ͳ w ͓͔͛ͰͷΞοϓάϨʔυ͘͠ͳ͔ͬͨʁ ΞϓϦίʔυͷඇޓ աڈ࠷େ
5IF'JSTU4UBCMF
w 3VCZ(FNT͕ඪ४ఴʹͳΔ w ruby setup.rbίϚϯυʹΑΔΠϯετʔϧ apt-get install railsͱ͍͏gemཧͱࠞ ͥΔͳةݥͷ౫ଡ
w ͜ͷޙ͘Β͍ʹ3BJMTʹ#VOEMFS͕౷߹͞Εͯ ύοέʔδཧͷΤίγεςϜ͕҆ఆͨ͠ ܥ࠷ॳͷ҆ఆόʔδϣϯ
.BOZ/FX'FBUVSFT
w ΩʔϫʔυҾɺModule#prependɺ γϯϘϧϦςϥϧɺEnumerable#lazyɺ َӢɺTracePointɺ3F fi OFNFOUTͳͲͳͲ w ӽ͠ͷΞοϓάϨʔυͰຊʹ৽ػೳ
Γͩ͘͞Μͩͬͨ w ϝλϓϩΪϟϯάେتͼʁ ޫͷػೳͱҋͷػೳͨ͘͞Μ
w εΫϦϓτΤϯίʔσΟϯάͷσϑΥϧτ͕ 65'ʹͳͬͨ ࠓϚδίϝෆཁ εΫϦϓτΤϯίʔσΟϯάෆཁ
*NQSPWFNFOUT
w ΞϓϦ໘Ͱେ͖ͳมߋࢥ͍ग़ͤͳ͍ վળʹײँ
4ZNCPM($
w 3BJMTͰ4ZNCPM($ඞਢͷͨΊಋೖ ͞Εͨ3VCZҎ্Λཁٻ͢Δ w ݫີʹόάϑΟοΫεͷҎ্͕ཁ݅ վળʹײँ
4FWFSBM6TFGVM4ZOUBYFT
w 4BGF/BWJHBUJPO0QFSBUPS ΅ͬͪԋࢉࢠ ʹΑΔ3BJMTΞϓϦͷtryͱtry!ͷஔ͖͑ w .Ͱेͳ߹ʹ&.Λكʹݟ͔͚Δ 4BGF/BWJHBUJPO0QFSBUPS
w 4RVJHHMZ)FSFEPDʹΑΔ3BJMTΞϓϦͷ strip_heredocͷஔ͖͑ 4RVJHHMZ)FSFEPD
• # frozen_string_literal: trueʹΑ ΔϚδοΫίϝϯτͰfreeze͞Εͨ String͕खʹೖΔΑ͏ʹͳͬͨ • RubyͷॊΒ͔͕͞ݮͬͨʁ w ͕࣌ٞৢ͞Ε͍ͯͨ
GTUSJOHMJUFSBMͷಋೖ
3VCZͰԆظޙͷԻࠫଡʁ https://mametter.hatenablog.com/entry/20151004/p1
3BJMTͱGTUSJOHMJUFSBMT https://github.com/rails/rails/pull/30342
*OUFHFS6OJ fi DBUJPO
ܯࠂͷ͕ྲྀΕΔ w 3VCZͷͱ͖ͱҟͳΓɺ·ͣඇޓͷ ඇਪܯࠂ͞Ε͍ͯͨ w 3VCZEFWΛ͏͜ͱͰϦϦʔε࣌ ʹͷ൙ཞ͕ݮΔΑ͏ʹύονΛૹ͍ͬͯͨ
044ͱৗ w HIR HFNTSD ཧϦϙδτϦ ͷඇਪܯࠂ ύονΛग़͢Τί γεςϜࢀՃͷ ͖͔͚ͬʹͳΔ
*NQSPWFNFOUT
w rescueelseensure͕doend ϒϩοΫʹॻ͚ΔΑ͏ʹͳͬͨͷॻ͖৺ ྑ͍ վળʹײँ
.+*53VCZ7."45
w ͍ͪΜ࣮༻໘ͰӨڹ͍ͯͦ͠͏ w 3VCZΛΠϯετʔϧͨ͠ޙʹ gem i bundlerͱ͍͏ఆܕّྱ͕ෆཁʹ #VOEMFS͕ඪ४ఴ͞ΕΔ
w .+*5͕ಋೖ͞Ε͕ͨɺ3BJMTΞϓϦέʔγϣ ϯͰͷ࣮༻ࣄྫՉฉʹͯ͠ฉ͔ͣͩͬͨ w 3VCZ7."CTUSBDU4ZOUBY5SFFʹΪϟϯά ͕ΞϓϦ֎ͰΓ্͕ΓΛݟ͍ͤͯͨ w ΞϓϦͷ࣮༻໘ͰFOEMFTTSBOHFͳͲͷ ৽ػೳΛ͑ΔΑ͏ʹͳͬͨ
͍Ζ͍Ζͱ࣮ݧతͳ೩ྉԼ
4VQFS)BSE.PEF3VCZ
LXBSHT w ͍͍ͩͨฐࣾͷ ύονձʹग़ͯͨ ਓͷपลͰΤί γεςϜଆͷ LXBSHTͷͷ ରԠΛਐΊ͍ͯͨ ҹ
w OVNCFSFEQBSBNFUFSͷελΠϧੋඇʹͭ ͍ͯʮ3VCZ8FCΛ࡞ΔͨΊͷݴޠͰ ͳ͘εΫϦϓτݴޠʯͱ͍͏ͷͳΔ΄Ͳ w ݸਓతʹอक͢Δίʔυʹ໊લ͕͍ͭͯ ͍ͯΒ͍͍͚ͨΕͲɺॻ͖ࣺͯεϥΠυ ྔΛݮΒ͢ͷʹศར ύλʔϯϚονφϯύϥ
"CTUSBDU*OUFSQSFUBUJPO
CVHTSVCZMBOHPSHJTTVFT 3VCZݴޠʹ͍͔ͳΔܗͰ͋Εܕએݴ ܕऍΛಋೖ͢ΔͭΓ͋Γ·ͤΜ
w ܕΛॻ͔ͣʹɺܕͷϝϦοτΛڗड͍ͨ͠ w 3#4ͩͱΞϓϦͰ·ͩܕΛॻ͘ίετ͕ߴ͘ ࠳ં͢ΔͷΛݟ͔͚Δ %3:Ͱͳ͘ਏ͍ w 3#*ͷಋೖίʔυ3VCZʹݟ͑ͣਏ͍ w
ྫ͑3#4͕πʔϧؒͷཪଆͷϨΠϠʔݴޠ ʹͳΔະདྷʁ நղऍͱ͍͏ୈͷಓ
:+*5
w .+*5ʹՃ͑ͯ-##7ʹج͍ͮͨ4IPQJGZ +*5Ͱ͋Δ:+*5͕ಋೖ͞Εͨ w 3BJMTΞϓϦͰ༗ޮԽͨ͠ޮՌଌఆ͕ʹ ͳΔ͜ͱ͕͋Δ͚ΕͲ-41ͰΫϥΠΞϯτ ͔ΒRUBY_YJIT_ENABLED=trueͯ͠ΈΑ͏ w FHWTDPEFSVCPDPQ TUFFQWTDPEF
:+*5
3VTU:+*58"4.
w :+*5ͷ࣮͕3VTUʹͳͬͨ w 3VTU:+*5ͷϏϧυͰࠔΔͱ͍͏ΛपลͰ ฉ͔ͳ͍ w %0$,&30''*$*"-*."(&͕ΘΕ͍ͯΔ ͷ͔ɺ3VTUΠϯετʔϧڭཆͳͷ͔ɺ :+*5ແޮͰͷϏϧυͱ͍ͯ͠Δͷ͔ 3VTU:+*5
w ࠷ۙ5SZ3VCZͷσϑΥϧτ͕0QBM͔Β 8"4.ʹͳ͍ͬͯͨ ΑΓྑ͍ೖʹ 8FC"TTFNCMZ 8"4. IUUQTUSZSVCZMBOHPSHQMBZHSPVOE
w ਖ਼نදݱ·ΘΓվળʹΑΔ3F%P4߈ܸରࡦ ࣮༻త w 3FBEPOMZͷStruct.new૬ͱͯ͠ Data.define͕ಋೖ͞Εͨ w 3BDUPSͷར༻ʹؔΘ͍͖ͬͯͦ͏ ͷݸਓతਪ͠
6OJWFSTBM1BSTFS3BDJOH
-SBNBBOE:"31 6OJWFSTBM1BSTFSݖ૪ୣͷηϝϯτ
w !KVOL-SBNBίϯτϦϏϡʔλʔ w !4)QBSTFZίϯτϦϏϡʔλʔ w !LPJD1BSTFSHFNίϛολʔ w !JNB[VNJ*3#ίϛολʔ w !GVHBLLCO3#4ίϯτϦϏϡʔλʔ
ߏจղੳثݚڀ෦ IUUQTNBHB[JOFSVCZJTUOFUBSUJDMFT'PMMPX6Q,JSJTIJNB3VCZIUNM
"CPWF"MM .BLF*U'VO