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
“kenkenize”で触れるRubyの中身 / Kenkenization and the ...
Search
Kentaro Kuribayashi
October 31, 2019
1
430
“kenkenize”で触れるRubyの中身 / Kenkenization and the Ruby Internal
K-Ruby #24
https://k-ruby.connpass.com/event/151523/
Kentaro Kuribayashi
October 31, 2019
Tweet
Share
More Decks by Kentaro Kuribayashi
See All by Kentaro Kuribayashi
Bidirectional Quadratic Voting Leveraging Issue-Based Matching
kentaro
2
350
大高生へのメッセージ(令和6年度「大高未来塾」) / Messages to Current Students
kentaro
0
240
「始め方」の始め方 / How to Start Starting Things
kentaro
5
860
Dynamic IoT Applications and Isomorphic IoT Systems Using WebAssembly
kentaro
1
1.3k
わたしがこのところハマっている「ライセンスフリー無線」のご紹介 / An Invitation to License-Free Radio
kentaro
1
500
先行きの見えなさを楽しさに変える ーVUCA時代のキャリア論と絶対他力主義ー / How to develop your career in the VUCA era
kentaro
7
5.4k
組織の生産性を高める意思決定の構造と方法 / How to do make decision rapidly and effectively
kentaro
41
22k
キャリアを時間・空間軸で考える / Thinking about your career from both time and space viewpoints
kentaro
15
16k
WEB+DB PRESSで特集記事を書く方法 / How to Become an Author of WEB+DB PRESS
kentaro
7
1.5k
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Practical Orchestrator
shlominoach
186
10k
Being A Developer After 40
akosma
89
590k
Code Review Best Practice
trishagee
65
17k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
960
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
4 Signs Your Business is Dying
shpigford
182
22k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
KATA
mclloyd
29
14k
Transcript
ʙϝλϓϩάϥϛϯάೖͱͯ͠ʙ ܀ྛ݈ଠ(.01FQBCP *OD ,3VCZ lLFOLFOJ[FzͰ৮ΕΔ3VCZͷத
(.0ϖύϘגࣜձࣾ ܀ྛ݈ଠBLB͋ΜͪΆͪΌΜ औక$50ɺࣛࣇౡΦϑΟενʔϜऀ IUUQTLFOUBSPLPSH
࣍ ࣄͷൃ LFOLFOHFNͷઆ໌ LFOLFOHFNͷ࣮ ͓ΘΓʹ
ࣄͷൃ
LFOLFOʹಥવ;ͬͯΘ͍ͨةػ ࣛࣇౡΦϑΟενʔϜʹLFOLFOͱ͍͏໊͋ͩͷΤϯδχΞ͕͍Δͷ͕ͩɺ ಥવͷվ໊ఏҊʹΑΔ໊͋ͩͷةػʂʂ̍
LFOLFOΛकΕʂʢʣ ·͋ɺͦ͏ͳΓ·͢ΑͶʜʜɻ
LFOLFOΛकΕʂʢʣ স͍ͷઈ͑ͳ͍ΞοτϗʔϜͳ৬Ͱ͢ɻ
LFOLFOΛकΕʂʢʣ ᰜͱݱΕΔΘͨ͘͠ͷఏҊɻ
lLFOLFOJ[Fzͷཁ݅ wཁ݅ ken ^ 2͕จࣈྻkenkenΛฦ͢ wͨͩ͠ɺม ken ʹจࣈྻken ͕ೖͬͯͯɺͦΕ͕ϝιου ^
ʹΑΓO ճ܁Γฦ͞ΕΔͱ͍͏࣮ͩͱͭ·Βͳ͍Ͱ͢ΑͶ wͦ͜Ͱɺมʹ͍͔ͳΔจࣈྻ͕ೖ͍ͬͯͯɺม໊Λnճ܁Γฦ͢͜ͱͰ ཁ݅Λຬͨ͢ίʔυʹ͍ͨ͠ɻ͜ͷॲཧΛlLFOLFOJ[FzͱݺͿɻ ͋ͳͨͳΒͲ͏͠·͔͢ʁߟ͑ͯΈ͍ͯͩ͘͞ɻ
LFOLFOHFNͷઆ໌
IUUQTHJUIVCDPNLFOUBSPLFOLFO
LFOLFOHFNͷ͍ํʢʣ
LFOLFOHFNͷ͍ํʢʣ จࣈྻ͕ͳΜͰ͋Δ͔ʹؔΘΒͣɺ ม໊͔Β܁Γฦ͢จࣈ͕ܾఆ͞ΕΔ
ཁ݅ͷ֬ೝ 㾎ཁ݅ ken ^ 2͕จࣈྻkenkenΛฦ͢ 㾎ͨͩ͠ɺม ken ʹจࣈྻken ͕ೖͬͯͯɺͦΕ͕ϝιου ^
ʹΑΓO ճ܁Γฦ͞ΕΔͱ͍͏࣮ͩͱͭ·Βͳ͍Ͱ͢ΑͶ 㾎ͦ͜Ͱɺมʹ͍͔ͳΔจࣈྻ͕ೖ͍ͬͯͯɺม໊Λnճ܁Γฦ͢͜ͱ Ͱཁ݅Λຬͨ͢ίʔυʹ͍ͨ͠ɻ͜ͷॲཧΛlLFOLFOJ[FzͱݺͿɻ ཁ݅ΛຬͨͤͨʂLFOLFOͷ໊͕͋ͩकΒΕͨʂʂ̍
LFOLFOHFNͷ࣮
LFOLFOHFN࣮ͷίΞʢൈਮʣ
eval͢Δ࣌ʹ3VCZͷ෦Ͱى͍ͬͯ͜Δ͜ͱʜᶃ 1BU4IBVHIOFTTZ 3VCZ6OEFSB.JDSPTDPQF"O*MMVTUSBUFE(VJEFUP3VCZ*OUFSOBMT /P4UBSDI1SFTT QQ
eval͢Δ࣌ʹ3VCZͷ෦Ͱى͍ͬͯ͜Δ͜ͱʜᶄ 1BU4IBVHIOFTTZ 3VCZ6OEFSB.JDSPTDPQF"O*MMVTUSBUFE(VJEFUP3VCZ*OUFSOBMT /P4UBSDI1SFTT QQ
LFOLFOHFN࣮ͷಓے wᶃͷྫ͔Β weval ͢Δͱɺ৽͍͠ελοΫϑϨʔϜ͕࡞͞ΕΔ wͦͷελοΫϑϨʔϜ͔ΒɺEPΛ௨ͯ͡ݩͷจ຺ͷมΛࢀরͰ͖Δ wᶄͷྫ͔Β wbindingΛ௨ͯ͡ɺݺͼग़͞ΕͨϝιουͷมΛࢀরͰ͖Δ wͭ·ΓɺbindingΛऔಘ͑͞Ͱ͖ΕɺͦͷٯͰ͖Δʹҧ͍ͳ͍ wϝιουݺͼग़͠ݩͷbindingΛ௨ͯࣗ͡ͷม໊ΛऔಘͰ͖Δͣʂ
LFOLFOHFN࣮ͷίΞͷղઆ ᶃݱࡏͷϑϨʔϜͷ;ͨͭ ্ͷbindingΛऔಘ ᶄᶃͷϑϨʔϜ্ͷϩʔΧ ϧมҰཡΛऔಘ ᶅᶄͰऔಘͨ͠ม໊Λᶃ ্ͰධՁ͠ɺΛಘΔ ᶆᶅͰಘͨͱࣗࣗ selfΛൺֱɻಉ͡ͳΒɺ ͦΕ͕తͷมͰ͋Δɻ
binding#of_callerϝιουɺCJOEJOH@PG@DBMMFSHFNʹΑͬͯՃ͞ΕͨϝιουͰɺίʔϧελοΫΛ͔͞ͷ΅ͬͯCJOEJOHΛऔಘͰ͖Δɻ
͓ΘΓʹ
·ͱΊͱิ wٕज़͕ͻͱΓͷਓؒͷ໊͋ͩΛकͬͨʂਖ਼͕࣮ٛߦ͞Εͨʂʂ̍ wݴޠͷ෦࣮ʹؔ͢ΔΠϝʔδ͕͋Δͱɺൃͷ෯͕͕Δʢ͔ʣ weval+bindingɺ͜͜Ͱղઆ͠ͳ͔ͬͨModule#class_eval BasicObject#instance_evalΛ͏ͱɺݱࡏͷίϯςΩετΛ͋Ε͜ ΕมߋͰ͖Δ w3VCZͰϝλϓϩάϥϛϯάΛ͍ͯ͠Δ߹ɺͦ͏͍͏ख๏Λ༻͍͍ͯΔ͜ͱ ͕ଟ͍ͷͰɺ͓ͬͯ͘ͱίʔυϦʔσΟϯάͷʹཱͭ ˞ࢀরͨ͠ॻ੶ץߦͷͨΊɺ࠷৽ͷ3VCZʹ͓͍ͯ෦࣮͕ҧ͍ͬͯΔ͔͠Ε·ͤΜɻͦͷลͷ֬ೝɺࠓޙͷ՝ͱ͍͏͜ͱͰɻ