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
410
“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
300
大高生へのメッセージ(令和6年度「大高未来塾」) / Messages to Current Students
kentaro
0
220
「始め方」の始め方 / How to Start Starting Things
kentaro
5
820
Dynamic IoT Applications and Isomorphic IoT Systems Using WebAssembly
kentaro
1
1.2k
わたしがこのところハマっている「ライセンスフリー無線」のご紹介 / An Invitation to License-Free Radio
kentaro
1
460
先行きの見えなさを楽しさに変える ーVUCA時代のキャリア論と絶対他力主義ー / How to develop your career in the VUCA era
kentaro
7
4.9k
組織の生産性を高める意思決定の構造と方法 / How to do make decision rapidly and effectively
kentaro
39
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.4k
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Happy Clients
brianwarren
98
6.7k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
400
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Visualization
eitanlees
145
15k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
GraphQLとの向き合い方2022年版
quramy
43
13k
Teambox: Starting and Learning
jrom
133
8.8k
How STYLIGHT went responsive
nonsquared
95
5.2k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
What's in a price? How to price your products and services
michaelherold
243
12k
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ʹ͓͍ͯ෦࣮͕ҧ͍ͬͯΔ͔͠Ε·ͤΜɻͦͷลͷ֬ೝɺࠓޙͷ՝ͱ͍͏͜ͱͰɻ