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
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
Outline View in SwiftUI
1024jp
1
330
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
CSC509 Lecture 11
javiergs
PRO
0
180
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.5k
みんなでプロポーザルを書いてみた
yuriko1211
0
260
ヤプリ新卒SREの オンボーディング
masaki12
0
130
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
610
Featured
See All Featured
The Language of Interfaces
destraynor
154
24k
For a Future-Friendly Web
brad_frost
175
9.4k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Raft: Consensus for Rubyists
vanstee
136
6.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
It's Worth the Effort
3n
183
27k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
What's new in Ruby 2.0
geeforr
343
31k
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