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
Rubyistなら知っておきたい継承の話 / The inheritance for Rubyist
Search
Hiroyuki Morita
July 29, 2018
4
1.4k
Rubyistなら知っておきたい継承の話 / The inheritance for Rubyist
TokyuRuby会議 12
Hiroyuki Morita
July 29, 2018
Tweet
Share
More Decks by Hiroyuki Morita
See All by Hiroyuki Morita
esaを使って暗黙知を減らす取り組み
chiastolite
2
4.1k
git-inside
chiastolite
0
240
vagrant-itamae
chiastolite
1
1.5k
sushi for common people
chiastolite
0
320
Social Coding with GitHub
chiastolite
0
140
Low Level Git
chiastolite
0
90
about Immutable Infrastructure
chiastolite
0
86
Featured
See All Featured
Unsuck your backbone
ammeep
668
57k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
890
Designing Experiences People Love
moore
138
23k
Code Reviewing Like a Champion
maltzj
520
39k
Docker and Python
trallard
40
3.1k
Ruby is Unlike a Banana
tanoku
97
11k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
How STYLIGHT went responsive
nonsquared
95
5.2k
For a Future-Friendly Web
brad_frost
175
9.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Documentation Writing (for coders)
carmenintech
65
4.4k
Transcript
RubyistͳΒͬͯ ͓͖͍ͨ ܧঝͷ 2018/07/29 TokyuRubyձٞ12 @chiastolite as cͳΜͱ͔e a.k.a ཧແ৬
a.k.a അձһূ
ܧঝͱ?
ܧঝ class Parent # Ϋϥε end class Child < Parent
# ࢠΫϥε end
͔ΒࢠʹҾ͖ܧ͕ΕΔͷʁ
! ! ῡ
Ҩ࢈૬ଓ
Ҩ࢈૬ଓͷجຊ 1. ඃ૬ଓਓͷࡒ࢈ͷࡧ 2. ඃ૬ଓਓͷࡒ࢈ͷׂΛڠٞ 3. (ඞཁͰ͋Ε) ૬ೲ੫ͷೲ
૬ଓ੫ͷਃࠂ
૬ଓ੫ͷਃࠂɾೲ10ϲ݄Ҏ begin start = Time.now if ਃࠂ͕ඞཁ? ਃࠂ ೲ੫ raise
'ظݶΦʔόʔ' if Time.now > start + 10.months end rescue ೲ੫ֹ + ແਃࠂՃࢉ੫ + Ԇ੫ end
ਃࠂͷఆ? جૅ߇আ = 30_000_000 def ਃࠂ͕ඞཁ? ૬ଓֹ > جૅ߇আ +
૬ଓਓ * 6_000_000 end def ૬ଓֹ amount ||= 0 amount += parent.ݱۚ amount += parent.༬ஷۚ amount += parent.ূ݊ amount += parent. amount += parent.ݐ amount += parent.ࣗಈं amount -= parent.࠴ end
૬ଓ੫ͷઅ੫
૬ଓֹΛઅ੫͢Δʹ → ੜલଃ༩ → ॅΒڭҭΒͷࢧԉΛͯ͠Β͏ → ͳͲΛങ͏ͱࢿ࢈ֹ͕ 㽊 → ඇ՝੫ͷࢿ࢈Λങ͏
→ ಛྫΛ͏ →খنͷಛྫ
ͦΕͰӽ͑ͯ͠·ͬͨΒʁ
͖͋ΒΊ·͠ΐ͏ɻਃࠂͩʂ
୭ʹཔΉʁ → ۜߦ → หޢ࢜ → ੫ཧ࢜ → ࢘๏ॻ࢜ →
ߦॻ࢜ ͩΕʹཔΊ͍͍ͷΒ…
!
͜ͷࡍɺࣗͰͬͯ͠·͍͍͑ͷʁ
ͱ͍͏Θ͚ͰͬͯΈͨ → ܭࢉͱ͔هೖྫ͕ͪΌΜͱ͋ΔͷͰ؆୯ → Ձ͕໌֬ͳݱۚ࠷ߴ
ਃࠂͷ໘ͳͱ͜Ζ → खॻ͖ॻྨ࠷ѱ →هೖϛεڐ͞Εͳ͍… → ඃ૬ଓਓͷੜ·Ε͔ͯΒͷށ੶౽ຊूΊ → ਃࠂઌʮඃ૬ଓਓʯͷ࠷ऴډॅ → Ͳ͜ʹݴͬͯʮ͓͑Ͱ͖ͳ͍ʯ
·͍͊Ζ͍Ζ͋Γ·͕ͨ͠
ͳΜͱ͔ͳΔͷ
࠷ޙʹ
ࣄલͷใେࣄ → ށ੶Ͳ͜ʹ͋Γͦ͏ʁ → Ͳͷۚ༥ػؔͬͯΔʁ → ӅΕͨࢿ࢈ͳ͍ʁ
Λฉ͔͕ͤͯΒͦΜͳΛͯ͠Έͯ?