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
320
大高生へのメッセージ(令和6年度「大高未来塾」) / Messages to Current Students
kentaro
0
230
「始め方」の始め方 / How to Start Starting Things
kentaro
5
840
Dynamic IoT Applications and Isomorphic IoT Systems Using WebAssembly
kentaro
1
1.2k
わたしがこのところハマっている「ライセンスフリー無線」のご紹介 / An Invitation to License-Free Radio
kentaro
1
480
先行きの見えなさを楽しさに変える ーVUCA時代のキャリア論と絶対他力主義ー / How to develop your career in the VUCA era
kentaro
7
5.2k
組織の生産性を高める意思決定の構造と方法 / 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
Building Applications with DynamoDB
mza
91
6.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
What's in a price? How to price your products and services
michaelherold
243
12k
Agile that works and the tools we love
rasmusluckow
328
21k
Site-Speed That Sticks
csswizardry
2
190
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Code Review Best Practice
trishagee
65
17k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
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ʹ͓͍ͯ෦࣮͕ҧ͍ͬͯΔ͔͠Ε·ͤΜɻͦͷลͷ֬ೝɺࠓޙͷ՝ͱ͍͏͜ͱͰɻ