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
Coming Soon…💎 / coming soon
Search
Akira Matsuda
October 03, 2020
Programming
12
7.8k
Coming Soon…💎 / coming soon
Kaigi on Rails 2020 の基調講演「Coming Soon...💎」の発表スライド
https://kaigionrails.org/
#kaigionrails
Akira Matsuda
October 03, 2020
Tweet
Share
More Decks by Akira Matsuda
See All by Akira Matsuda
初心者のためのRubyKaigi入門/RubyKaigi Introduction
a_matsuda
13
4.8k
Hanamiを支える技術 2023 / Asakusa.rb Hanami 2023
a_matsuda
2
550
Rails 7.1をn倍速くした話
a_matsuda
11
12k
RubyKaigi 2022 After Talk
a_matsuda
0
410
Rails Performance Issues and Solutions
a_matsuda
9
35k
Extending Rails for Real World App Development
a_matsuda
9
7.4k
A RubyKaigi Talk
a_matsuda
8
2.4k
Ginza Rails 1
a_matsuda
6
1.2k
Oedo 07
a_matsuda
8
930
Other Decks in Programming
See All in Programming
あれやってみてー駆動から成長を加速させる / areyattemite-driven
nashiusagi
1
200
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
670
Criando Commits Incríveis no Git
marcelgsantos
2
160
103 Early Hints
sugi_0000
1
200
MCP with Cloudflare Workers
yusukebe
2
210
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
920
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
0
240
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
250
バグを見つけた?それAppleに直してもらおう!
uetyo
0
170
事業成長を爆速で進めてきたプロダクトエンジニアたちの成功談・失敗談
nealle
3
1.4k
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
160
Discord Bot with AI -for English learners-
xin9le
1
120
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
88
5.7k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.8k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
For a Future-Friendly Web
brad_frost
175
9.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Agile that works and the tools we love
rasmusluckow
328
21k
Six Lessons from altMBA
skipperchong
27
3.5k
How to Ace a Technical Interview
jacobian
276
23k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
How GitHub (no longer) Works
holman
311
140k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Transcript
@amatsuda Coming Soon...💎 @amatsuda
ಥવͰ͕͢ɺ
OSSΓ͍ͨʂ 🛤 Α͍͘ΖΜͳͱ͜ΖͰ૬ஊ͞ΕΔ
͍ΖΜͳͱ͜Ζ 🛤 Asakusa.rb 🛤 ӬγεςϜϚωδϝϯτ͞ΜͷOSSύονձ 🛤 ͍ΖΜͳձࣾ 🛤 Πϯλʔωοτ
🤔
ʮΓ͍ͨͳΒΕ͍͍ͷ Ͱʁʯ 🛤 ʮύονΛॻ͘ʯҎ֎ʹΔ͖͜ͱͳ͍ 🛤 ύονΛॻ͘ରͷιϑτΣΞੈͷதʹແʹ ͋Δ
🔜
ͨͿΜࠓ͙͢ύονΛॻ͔ͳ͍ ཧ༝ٕज़ྗෆͱ͔Ͱͳ͍ 🛤 Έ 🛤 Ϟνϕʔγϣϯ 🛤 ετʔϦʔ 🛤 ͖͔͚ͬ
͖͔͚ͬ͞·͟· 🛤 ࠓɺ͍ΖΜͳϓϩμΫτΛհ͠ͳ͕ΒɺͦΕ Λॻ͍͖͔͚ͨͬͦͷͱ͖ߟ͍͑ͯͨ͜ͱͳͲΛ ͝հ 🛤 OSS։ൃʹڵຯ͕͋Δ͚Ͳ࢝Ί͔͕ͨΘ͔Βͳ ͍ɺܧଓͰ͖ͳ͍ɺͱ͍͏ํͷࢀߟʹͳΕ
ͱ͍͏ײ͡ͰɺࠓࣗຫΛ ͠ʹདྷ·ͨ͠ʂ 🛤 ࣗຫͱࣗըࣗࢍ 🛤 RubyKaigiͰ͍ͭεϐʔΧʔͷօ͞Μʹ͓ئ͍ ͯ͠Δͭ
self 🛤 name: Akira Matsuda 🛤 GitHub: @amatsuda 🛤 Twitter:
@a_matsuda
ੈքతʹ༗໊ͳϓϩάϥϚʔ ͡Ί·ͨ͠
ոจॻ
https://jp.quora.com/ϓϩάϥϛϯάʹ͓͍ͯ- ੈքతʹ༗໊ͳຊਓ͍/answers/141576838
https://twitter.com/joker1007/ status/1157578882184183808
ͦΜͳ͜ͱͳ͍Ͱ͢ʼʻ 🛤 ݺΕΕͲ͜Ͱߦ͘ؾຬʑͳͷʹࠃ͔Β ͥΜͥΜ͔͚ͯΒ͑ͳ͍͚ͩͳΜͰ
Rubyίϛολʔ
Railsίϛολʔ
͔ͤͬ͘ͷୈ1ճKaigi on RailsͳͷͰ ͪΐͬͱ͚ͩRailsͷ
Railsͱࢲ
ݹגίϯτϦϏϡʔλʔ 🛤 https://contributors.rubyonrails.org/
https:// contributors.rubyonrails.org/
SinceͷཝΛݟΔͱΘ͔Δ
13
͜ͷதͰɺݱͰίϛοτ ͯ͠Δਓ 🛤 ҾୀΛද໌ͨ͘͠͠3Ҏ্ίϛοτͯ͠ͳ͍ ਓΛফ͜͠ΜͰΈΔ
ݱ
RailsίϛολʔͲΜͲΜਓ͕ ೖΕସΘ͍ͬͯΔ͜ͱ͕Θ͔Δ 🛤 ྺͷઙ͍ϝϯόʔ͕ͨͪ׆༂͍ͯ͠Δ
RailsϓϩδΣΫτɺଓ͍͍ͯΔΘΓ ʹɺ͔ͳΓ݈શʹӡӦ͞Ε͍ͯΔͷͰͳ͍͔
RubyRailsͷपลͷ͍Ζ͍Ζ
Asakusa.rbओ࠵ͯ͠·͢
Asakusa.rbओ࠵ͯ͠·͢
ΦϯϥΠϯͰຖिՐ༵ʹͬͯΔ ͷͰ͓ؾܰʹ༡ͼʹདྷ͍ͯͩ͘͞
RubyKaigiͷ νʔϑΦʔΨφΠβʔͬͯ·͢
RubyKaigi Takeout 2020͝ࢀՃ ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ
RubyKaigi 2021 🛤 https://rubykaigi.org/2021
Kaigi on Railsͱࢲ
ͳΜ͔RailsͷΠϕϯτΓ͍ͨͬͯݴͬͯΔେ͞Μ Λogijun͞ΜʹҾ͖߹ΘͤͯKaigi on Railsͷ໊લΛ ݱʹોΒͤͨͷΦϨΦϨ 🛤 ͱ͍͏ઌिͷۜ࠲RailsͰ͏ͬͨͷͰলུ
झຯͰΑ͘ύονΛ ॻ͍͍ͯ·͢
ࠓिɺͱ͋Δ͓ࣄͷRailsΞϓϦ ͷϦϙδτϦͰूܭͯ͠Έͨ݁Ռ 🛤 Railsຊମ͓ΑͼrailsΦʔΨχθʔγϣϯͰϝϯς͍ͯ͠Δgemͨͪ (16ݸ) 🛤 ͕ࣗ࡞ͬͨͷ (6ݸ) 🛤 ϝϯςφΛͬͯΔ(=
ίϛοτݖΛ͍࣋ͬͯΔ)ͷ (4ݸ) 🛤 ্هҎ֎ͷ͏ͪɺաڈʹ1ͭҎ্Կ͔Λίϛοτͨ͜͠ͱ͕͋Δͷ (86ݸ) 🛤 ະίϛοτͷͷ (211ݸ)
ΞϓϦͰbundle͍ͯ͠Δgemͷ͏ͪ 112/323 ʹԿ͔͠Βίϛοτͯͨ͠ 🛤 3ͷ1ڧ͙Β͍ 🛤 ͜Μͳײ͡Ͱɺͱʹ͔͍͘ΖΜͳgemΛಡΈॻ͖ ͠·͘ΔελΠϧ
͍ΖΜͳਓ͕ॻ͍͍ͨΖΜͳίʔυΛ ಡΈॻ͖͢Δͷָ͍͠ͷͰ͓͢͢Ί
ͦͷͨΊʹɺࠒ͔Β͍ΖΜͳίʔυΛಡΈ ॻ͖͢Δ·ͰͷϋʔυϧΛԼ͓͛ͯ͘ͷ͕େࣄ 🛤 ಡΈ͍ͨɺͱࢥͬͨ࣍ͷॠؒʹαοͱಡΈ࢝ΊΒ ΕΔΑ͏ʹ 🛤 ͦͷͰ͙͢ʹύονΛॻ͖࢝ΊΒΕΔΑ͏ʹ
OSSϥΠϒϥϦͷίʔυΛಡΜͰ ύονΛॻ͘ϋʔυϧΛԼ͛Δʹ 🛤 ·ͣgem-src
💎 gem-src 🛤 ͍ΖΜͳgemͷιʔείʔυ͕ϞϦϞϦऩूͰ͖Δ ͭ 🛤 gem installίϚϯυΛ֦ுͯ͠ɺΠϯετʔϧͷ ͍ͭͰʹgemͷιʔείʔυΛউखʹखݩʹclone ͯ͘͠ΕΔΑ͏ʹ͢Δ
ࠓேɺେ͖ͳػೳՃΛ ͠·ͨ͠
gem-src as a Bundler Plugin! % bundler plugin install gem-src
ࠓ·Ͱࠔ͍ͬͯͨ͜ͱ 🛤 ͠Β͘લͷBundlerͷ༷มߋͷ͍ͤͰɺ Bundlerܦ༝ͰΠϯετʔϧ͞ΕͨgemͰafter- install hook͕Βͳ͘ͳ͍ͬͯͨ
BundlerϓϥάΠϯԽ͢Δ͜ͱͰɺBundlerܦ༝ͰΠϯ ετʔϧ͞Εͨgemʹgem-src͕ޮ͘Α͏ʹͳͬͨ
RubyGemsϓϥάΠϯ݉ rbenvϓϥάΠϯ݉BundlerϓϥάΠϯ 🛤 1ϦϙδτϦͰτϦϓϧϓϥάΠϯʂ 🛤 ͜ΜͳϓϩμΫτͨͿΜੈքॳͩͱࢥΘΕΔ 🛤 ͱ͍͏͔RubyGemsϓϥάΠϯrbenvϓϥάΠϯ BundlerϓϥάΠϯϚΠφʔ͗ͯ͢୭࡞ͬͯ ͳ͍
ࠓ͔Βɺrbenvͱbundlerͷ྆ํ ͱʹΈࠐΜͰ͓͘ͷ͕ਪઃఆ % git clone https://github.com/amatsuda/gem-src.git "$(rbenv root)/plugins/gem-src" %
bundler plugin install gem-src
ར༻͍ͯ͠Δgemͷιʔείʔυશͯखݩʹ ஔ͍͓͚ͯΔΑ͏ʹͳͬͯɺύονΛൃࣹ͢Δ·Ͱ ͷϦʔυλΠϜ͕ܶతʹॖ·Δ 🛤 ͷखݩͰਪఆ2000ݸఔ͕cloneࡁΈͰɺ ͍ͭͰύον͕ॻ͚Δঢ়ଶʹͳ͍ͬͯΔ 🛤 ͜Ε͕ແ͍ͱOSS׆ಈ͕Ͱ͖ͳ͘ͳΔ͘Β͍ศར
͜ΕͰࠓ͔Βύον͕ૉૣ͘ ॻ͚ΔΑ͏ʹͳΔͣͰ͢
🔜
ࠓ͔ΒύονΛͨ͘͞Μ ॻ͍͍͖ͯ·͠ΐ͏
ͦΕ͔Βɺͷ߹ɺଞਓͷϓϩμΫτʹύονΛ ͛Δ͚ͩ͡Όͳͯ͘ɺझຯͰΑࣗ͘࡞ͷgemΛ ࡞͍ͬͯ·͢
ࣄฑɺओʹʮRailsϓϥΪϯʯ
"Rails Plugin" 🛤 ࢮޠʁ 🛤 ࠷ۙͰ୯ʹ"gem"ͬͯݴΘΕͯΔʁ
gem != Rails Plugin
ͨΓલ͚ͩͲɺੈͷதʹRailsͷ֦ ுҎ֎ͷgem͋Δ
💎 rfd
rfd 🛤 RubyͰ࡞ͬͨFD(ϑΝΠϥʔ)ͷΫϩʔϯ
ݟͲ͜Ζ 🛤 rfd/commands.rb 🛤 Կ͔Ωʔ͕ԡ͞ΕΔͱɺͱʹ͔ͦ͘ͷΩʔͷ໊લͷ ϝιου͕࣮ߦ͞ΕΔ
͖͔͚ͬ 🛤 ͜ͷcommands.rbͷΈΛࢥ͍͍ͭͯ͠·ͬͨ ͷͰ࣮ͯ͠Έͨ͘ͳͬͯ࡞ͬͨ
ϝϯς 🛤 2ը໘ରԠͱ͔͍ͨ͠ͱࢥ͍ଓ͚ͯؒ์ஔத…… 🛤 ։ൃΛखͬͯ͘ΕΔํืूத
gem != Rails Plugin 🛤 ࠓٯʹɺgemͰͳ͍Rails pluginͷύλʔϯ
ੲRailsͷ֦ுgem͡Ό ͳ͔ͬͨ
💎 i18n_generators
i18n_generators 🛤 Rails I18nͷϦιʔεϑΝΠϧΛࣗಈ༁Ͱੜ͠·͘Δͭ 🛤 ͕ॳΊͯࣗͰ࡞ͬͨRails plugin 🛤 (ͦΕҎલʹଞਓ͕࡞ͬͨͷΛforkͯ͠ϝϯςͱ͔͙ͯͨ͠Β͍) 🛤
2008 🛤 GitHubͱ͔Asakusa.rbͱ͔͕Ͱ͖ͨ
First CommitΛݟͯΈΔͱ…… 🛤 https://github.com/amatsuda/ i18n_generators/commit/7a9b45c
Installation
gem install ͱ͔ bundle install ͡Όͳ͍ʂ 🛤 ࣌gem͡Όͳ͔ͬͨ͜ͱ͕Θ͔Δ
Rails pluginͱͯ͠ൺֱతྺ࢙ ͕ͯͣͬ͘ͱϝϯςͯ͠ΔͷͰ 🛤 Ruby 1.8ʙ3.0ͷશͯͷόʔδϣϯRubyͰಈ͘ 🛤 Rails 3.0ʙ6.1ͷશͯͷόʔδϣϯRailsͰಈ͘ 🛤
ݱଘ͢ΔRails I18nؔ࿈ϓϩμΫτͱͯ͠࠷ݹͷ ͷ͔͠Εͳ͍
࡞͖͔͚ͬͨͬ 🛤 Rails I18nϓϩδΣΫτʹ࠷ॳ͔ΒؔΘͬͨຊਓͩͬͨ 🛤 ࣌͘ΘΕ͍ͯͨ gettext-rails ͷϦιʔεΛϕʔεʹͯ͠ɺຊମଆ ͷ ja.yml
Λॻ͍ͨ 🛤 ΞϓϦͷYAMLΩʔͷ໋໊نଇ͕ܾ·ͬͯΔΜ͔ͩΒࣗಈੜͰ͖ ΔͷͰʁͱࢥͬͨͷͰͬͯΈͨ 🛤 Rails I18n͢ΔͳΒ͜͏͍͏ͷ͕ඞਢͰʁͱࢥͬͯ࡞͚ͬͨͲɺ ҙ֎ͱ·Βͳ͔ͬͨ
ٯʹɺ࡞ऀ͕ࢥͬͨҎ্ʹ ·ͬͯ͠·ͬͨͷ
💎 kaminari
kaminari 🛤 ϖʔδωʔγϣϯ͢Δͭ 🛤 2011
࡞͖͔͚ͬͨͬ 🛤 ࣌σϑΝΫτͩͬͨwill_paginate͕Rails 3ʹ ͳ͔ͳ͔ରԠͯ͘͠Εͳͯ͘ࠔͬͯͨ 🛤 ͦͷ͜Ζ࡞ऀͨͪGitHub͍ͬͯ͏ελʔτΞοϓ Λۀ͔ͯͯͬͨ͠͠ 🛤 Rails
3ͷ৽ػೳΛ͑ͬͱ͏·͘࡞ΕΔؾ͕ͨ͠
Rails 3ͷ৽ػೳ 🛤 Active RecordͷϝιουνΣΠϯํࣜͷ৽API 🛤 Rails Engine
Rails 3ͷ৽ػೳʹ͍ͭͯͷৄ͍͜͠ͱ ࣌ WEB+DB Press Vol. 58 ʹॻ͍ͨ 🛤 ૯ूฤͷDVDΛങ͑ࠓͰಡΊ·͢
ݱଘ͢ΔதͰੈքͰԿ൪͔ʹ ݹ͍Rails Engine͔͠Εͳ͍
kaminari͍ͬͯ͏;໊͚ͨ͟લ 🛤 ίʔυॻ͚ͨΜ͚ͩͲɺ໊લ͕ܾΊΒΕͳͯ͘ 2ि͙ؒΒ͍ϦϦʔεͰ͖ͳ͔ͬͨ 🛤 ౦ژRubyձ͔ٞͳΜ͔Ͱhsbt͞Μʹ͖ͯͱ͏ʹ ܾΊͯΒͬͨ
ڞಉϝϯςφ 🛤 @yuki24 🛤 ࣌Issue͕100ݸͱ͔ཷ·ͬͯΔͷΛݟΔʹݟ͔Ͷ ͯɺAsakusa.rbͷmeetupͰʮख͍·͠ΐ͏ ͔ʁʯͬͯݴͬͯ͘Εͨ
ͻͲ͍ίʔυ 🛤 ·͍͋Ζ͍Ζྺ࢙తܦҢ͕͋ΔΜͰ͢Α 🛤 ࠓͱͳͬͯݟͲ͜Ζಛʹͳ͍͠ɺίʔυ৭ʑ ͻͲ͍ΜͰಛʹಡΉඞཁͳ͍
2011ͭͳ͕Γ 🛤 2011ʹ࡞ͬͨଞͷgem
💎 action_args
action_args 🛤 Railsͷίϯτϩʔϥʔ͕MerbΈ͍ͨʹͳΔͭ 🛤 ͜ΕφγͰRailsͳΜ͔͑ͳ͘ͳΔ͙Β͍ศར ͳͭ
͕ࣗ࡞ͬͨgemͷதͰҰ൪͖ ͳ͔ͭ͠Εͳ͍
࡞͖͔͚ͬͨͬ 🛤 Rails 3ͷίϯτϩʔϥʔͷίʔυ͕ؾʹ৯Θͳ ͔͔ͬͨΒ
Rails 2 + Merb = Rails 3 🛤 ίϯτϩʔϥʔʹؔͯ͠ɺྑ͘ͳ͍ํͷAPIΛ બͯ͠͠·ͬͨ
🛤 ͜͜ͰMerbํࣜΛαϙʔτͰ͖ͳ͔ͬͨͷRails ͷྺ্࢙গͳ͍DHHͷஅϛεͩͱࢥ͏
ݟͲ͜Ζ 🛤 https://github.com/asakusarb/action_args/ commit/895b1ad
"using Refinements in order not to reveal our plugin internal
methods"
͜ͷgemͷதͰ͔͠Θͳ͍ϓϥΠϕʔτͳ ϝιουΛੜͨ͢ΊʹrefinementsΛ׆༻ 🛤 ͜͜ͰɺActionController::Base ʹϓϥΪϯ ෦༻ͷϩδοΫΛՃ͍ͯ͠ΔΜ͚ͩͲɺͦΜͳ ͷ͕ϢʔβʔͷΞϓϦʹ࿙Εग़ͪ͠Ό͏ͱΧοίѱ ͍ 🛤 ͦ͜ͰɺϑΝΠϧείʔϓͳϝιουΛݺͼ͍ͨͱ
͜ΖͰ͚ͩੜ͢Α͏ʹ͢Δ
20158݄ 🛤 ͜ͷίϛοτ͕ߦΘΕͨ20158݄ʹԿ͕͋ͬͨͷ ͔ʁ
͖͔͚ͬ @_ksss_ ͞Μͷπ Πʔτ
https://twitter.com/_ksss_/ status/631458253688340480
https://twitter.com/a_matsuda/ status/631470723974873093
https://twitter.com/_ksss_/ status/631478188414144512
https://twitter.com/_ksss_/ status/631589269283303424
https://twitter.com/a_matsuda/ status/631608168175415296
ͪͳΈʹཌʹRailsʹೖΕͨ 🛤 https://github.com/rails/rails/commit/ 571f0f32 🛤 ͜Ε͕Rails্࢙ॳrefinements
https://github.com/rails/ rails/commit/571f0f32
Refinements 🛤 ͓ࣄͷRailsΞϓϦͰ΄ͱΜͲ͍ಓ͕ͳ͍͚ ͲɺϥΠϒϥϦϑϨʔϜϫʔΫͷ։ൃʹ͛͢ʔ ศར
͓ͦΒ͘͜ͷػೳΛ͏·͘͏ͱɺΊͪΌΊ ͪΌ៉ྷͳϑϨʔϜϫʔΫΛ࡞Δ͜ͱՄೳ͔ 🛤 public APIϝιουҎ֎ϢʔβʔʹԿݟ͑ͯͳ ͍Έ͍ͨͳ 🛤 ͰRails͍·͞Βແཧ͔ͳ……
ͦΕ͔Βɺ2011ʹ࡞ͬͨͷΛ ͏ͻͱͭ
💎 active_decorator
active_decorator 🛤 ͍ΘΏΔσίϨʔλʔ 🛤 Active Model͕ੜͨ͜͠ͱ͋ͬͯɺ Presenterύλʔϯͱ͔ͦ͏͍͏ͷ͕ྲྀߦͯͨ͠ 🛤 Draper͕Ͱ͖ͨͷ͜ͷ͜Ζ
͖͔͚ͬ 🛤 Draperͷख৮Γ͕͋·ΓʹRubyΒ͘͠ͳͯ͘ ؾ࣋ͪѱ͍ͷͰɺࣗͰͬͱײ৮ͷྑ͍ͷΛ ࡞ͬͨ 🛤 ਖ਼͍͠ઃܭͱਖ਼͍࣮͠Λࢥ͍͍ͭͯ͠·ͬͨ
ਖ਼͍͠ઃܭͱਖ਼͍࣮͠ 🛤 view helperͳΜ͔ͩΒɺhelperͱಉ༷viewͷதͰ ͚ͩ༗ޮʹͳΔ͖ => 🛤 ͋ɺͱ͍͏͜ͱɺview_assigns ͷλΠϛϯάͰҾ ͖͠ରͷivarΛObject#extend͢Ε͍͍ͷͰ
ʂ
view_assignsͱ͔;ͭ͏Βͳ͍ ͱࢥ͏ΜͰ͚͢Ͳɺ 🛤 ͜ͷAPIͷ͕ࣝ͋Δ͔ͳ͍͔͕ɺDraperͱͷ ख৮ΓͷࠩΛੜΜͩ
WEB+DB Press Vol.58ͷಛू1Λॻͨ͘Ίʹ Rails 3ͷίʔυΛಡΈ·ͬͨ͘ͷ͕࣮݁ͨ͠
ख৮Γ 🛤 ;ͭ͏ͷRubyͷϞδϡʔϧΛૉʹ͏͚ͩ 🛤 ಛघͳجఈΫϥεΛܧঝͱ͔͠ͳ͍ 🛤 ͓·͡ͳ͍Λ֮͑ͳͯ͘ྑ͍ 🛤 RubyͷύϫʔΛͦͷ··͏
ࣅͨΑ͏ͳίϯηϓτͷͷΛ ͏1ݸ
💎 jb
jb 🛤 JSONΛ࡞ΔͨΊͷςϯϓϨʔτΤϯδϯ 🛤 jbuilder͍ͬͯ͏DSL͕ԚΒ͍ͯ͘͠ํ͕֮͑ ʹ͍ͭ͘ͷalternative
ίϯηϓτ 🛤 JSONͱRubyͷHash͍͍ͬͯͩͨҰॹͩΑͶ 🛤 ςϯϓϨʔτͷதͰจࣈྻΛͬͨுͬͨͯ͠ JSONͬΆ͍จࣈྻΛΈཱͯΔΜ͡Όͳͯ͘ɺ HashͷΠϯελϯεΛ࡞ͬͨΒͦΕΛJSONʹ͠ ͯ͘ΕΔ΄͏͕ײతͩ͠ے͕ྑ͍ͷͰʁ
ઃܭͱ࣮ 🛤 Action ViewͰ1ຕ1ຕͷςϯϓϨʔτ͕ίϯύΠϧ͞Εͨ ͷ͕ϝιουͱͯ͠ఆٛ͞ΕΔ 🛤 jbͰίϯύΠϧԿͳͯ͘ɺςϯϓϨʔτʹॻ͍ͨͷ ͕ͦͷ···ΔͬͱϝιουbodyʹͳΔ 🛤 ͦͷϝιου͕HashͷΠϯελϯεΛฦ͢Α͏ʹ͢Ε͍
͍͚ͩɻͱʹ͔͘;ͭ͏ͷRubyΛॻ͚ྑ͍
ϝϦοτ 🛤 ṖͷDSLΛ֮͑ͳͯ͘ྑ͍ 🛤 Կͯ͠ͳ͍ͷͰ͍ 🛤 jbuilderΑΓϑΝΠϧ໊ͷ֦ுࢠ͕͍
ݟͲ͜Ζ 🛤 template handlerͷԿͬͯͳͬ͞Γ
lib/jb/handler.rb
handler͕Կͬͯͳ͍ςϯϓϨʔτ ΤϯδϯΛ͏1ݸ
💎 string_template
ݱଘ͢ΔRubyͷςϯϓϨʔτ ΤϯδϯͷதͰӉ࠷
jbͱಉ͡ײ͡ͰɺςϯϓϨʔτ͕ ͦͷ··ϝιουbodyʹͳΔ 🛤 ͦ͜Ͱฦͨ͠String͕ͦͷ··HTMLͱ͔ʹͳΔ
ςϯϓϨʔτ͕ΫΦʔτ͞Εͨͷ͕ ·Δ͝ͱ1ຊͷStringϦςϥϧʹͳΔ 🛤 ແବͳbufferΦϒδΣΫτ͕ΘΕͣʹҰܸͰ String͕ΈཱͯΒΕΔͷͰੈք࠷
ͨͩͷRubyͳͷͰɺಛघͳຒΊࠐΈ ه๏ͱ͔Ұͳ͍
<%= %> ͱ͔ແͯ͘େৎͳͷʁ
RubyͷStringʹ #{} ͷ interpolation ͕͋ΔΜͰ͢Αʂ 🛤 ͜ΕͰ͚ͬ͜͏ͳΜͱ͔ͳΔ
͍Ͳ͜Ζ 🛤 layoutϑΝΠϧͱ͔Έ͍ͨͳɺΊͬͪΌrender͞ ΕΔ͚Ͳ͋·Γසൟʹ͍͡Βͳ͍Α͏ͳͷ͜Ε Ͱॻ͍͓ͯ͘ͱύϑΥʔϚϯε͕Ք͛Δ͔
ݟͲ͜Ζ 🛤 ͬͺΓtemplate handlerͷԿͬͯͳͬ͞ Γ
lib/string_template/ handler.rb
Τϯδϯͭͳ͕Γ 🛤 ΤϯδϯΤϯδϯͰɺࠓςϯϓϨʔτΤϯ δϯ͡Όͳͯ͘ Rails Engine
💎 heavens_door
heavens_door 🛤 ΈΜͳେ͖Capybaraͷςετίʔυ͕ɺϒϥ βͷૢ࡞͔ΒੜͰ͖ΔEngine
໊લ 🛤 ࿐ઌੜͷελϯυ 🛤 ͳΜ͔ͦΕͬΆ͍ؾ͕ͨ͠Μ͚ͩͲɺ·͋Θ͔Γʹ ͔ͬͨ͘Ͱ͢Ͷ
͖͔͚ͬ 🛤 ZOZOςΫϊϩδʔζ͞Μͷ৽نҊ݅ͰɺΈΜͳͰ systemςετॻ͜͏͍ͥͬͯ͏͜ͱʹͳͬͯ 🛤 Ͱखॻ͖Ͱ͍͍ͪͪॻ͘ͷେมͩͬͨͷͰ
࣮ϒϥβૢ࡞Ϟʔυ͚ͩ͡Όͳͯ͘ ίϚϯυϥΠϯϞʔυ͋ͬͨΓ͢Δ
ίϚϯυϥΠϯϞʔυʁ 🛤 ࡞ͬͨຊਓʹ͔͍͠ํ͕Θ͔Βͳ͍πʔϧʹͳΓ ͦ͏ͳͷͰ৸͔ͤͯ͋Δ
ઌߦݚڀ 🛤 ͜ͷϒϥβ্ͷૢ࡞Λهͯ͠capybaraͷίʔ υΛు͘ػೳɺ2010ʹ࡞ͬͨhocus_pocusͬ ͍ͯ͏Rails Engine pluginͷػೳͱͯ͠طʹ࣮ ࡁΈͩͬͨͷ
͜Μͳ;͏ʹxxܦ͔ͬͯΒੲॻ͍ͨ ίʔυͷժ͕ग़ͨΓ͢Δ͜ͱ͋Δ 🛤 ίʔυΛॻ͖ଓ͚ͯΔͱΞυόϯςʔδ͕͋ͬ ͨΓ͢Δɺͱ͍͏ࣄྫ
💎 hocus_pocus
hocus_pocus 🛤 WikiΈ͍ͨͳײ֮Ͱɺϒϥβ্Ͱૢ࡞ͨ͠Βαʔ όʔ্Ͱϖʔδ͕࡞ΕΔRails Engine
࡞Γ࢝Ίͨͷ2010 🛤 Kaminari͕Engineͱͯ͠૬ݹ͍͖ͬͯͬ͞ ݴ͚ͬͨͲɺͦΕΑΓݹ͔ͬͨ 🛤 ͍͢͝Φʔύʔπ͔͠Εͳ͍
͍·͍ͪྲྀߦΒͳ͔ͬͨ…… 🛤 UI͕ϔϘ͗ͨ͢ 🛤 πʔϧࣗମͷ֓೦͕͗ͨ͢͠ 🛤 υΩϡϝϯτ͕ແͩͬͨ 🛤 Γ͔ͨͬͨ͜ͱͰ͖ͦ͏ʂͬͯࢥͬͨΒͳΜ͔ ͖ͨ
͍͍ͩͨͰ͖ͨʂ => ͪΌΜͱ͑ Δ·Ͱ࡞ΓࠐΉͷ͕ۤख
ίϯηϓτ͕ಛघ͍ͩ͠ํղͰɺ࡞ͬͨ ຊਓʹ͔͍͠ํ͕Θ͔Βͳ͍πʔϧʹͳͬͯ ͠·ͬͨ
͜ͷϓϩμΫτ͕ٴ΅ͨ͠Өڹ 🛤 Railsඪ४ͷweb-consoleΛΠϯεύΠΞ 🛤 https://github.com/rails-girls-summer-of- code/summer-of-code-2014/wiki/Project- ideas#conductor-web-based-assistant-for- development
࡞ͬͨߕ൹͋ͬͨΈ͍ͨ 🛤 ݁ہweb-consoleͬͯΔ͜ͱͥΜͥΜҧ͏ ͚Ͳ……
Capybaraؔ࿈ͷϏδϡΞϧܥͷ EngineΛ͏1ͭ (͋ͱ͍ͭͰʹݴ͏ͱϓϩάϨۂ໊ͭͳ͕Γ)
💎 roundabout
roundabout 🛤 ը໘ભҠਤੜπʔϧ
ը໘ભҠਤͷੜ 🛤 ࣮ͱͯ͠CapybaraͷϞϯΩʔύον 🛤 ςετίʔυதʹCapybaraͰൃੜͨ͠ϦΫΤετ ͷભҠΛશ෦ه͢Δ 🛤 ͜ΕΛͭͳ͛ͯֆʹ͢Δͱը໘ભҠਤʹͳΔ
͜Μͳײ͡(RedmineϓϩδΣΫτͰ ࣮ߦͨ݁͠Ռ)
ਤʹςετ͕ॻ͔Ε͍ͯΔ ͷ͔͠ग़ͯ͜ͳ͍ 🛤 ͭ·Γɺ͋ΔछͷςετΧόϨοδతͳͷ͕Մࢹ Խ͞ΕΔπʔϧͰ͋Δͱݴ͑Δ
ΞΠσΞ͓͠Ζ͍͠ɺϙςϯγϟϧ͋Δ ؾ͕͢ΔΜ͚ͩͲɺ͋·ΓΘΕͯΔखԠ͑ ͳ͍͔ 🛤 ͜ΕΛػʹͥͻ͝ར༻͍ͩ͘͞
ΧόϨοδؔ࿈ͭͳ͕ΓͰ
💎 per_file_coverage (unreleased)
per_file_coverage (Ծ) 🛤 ςετ࣮ߦ࣌ʹɺΞϓϦΛߏ͢Δ֤ϑΝΠϧ͕ Ͳͷςετ͔Βݺͼग़͞Ε͍ͯΔ͔(ͱɺͦͷٯ)Λ શ෦ચ͍ग़ͯ͠ՄࢹԽ͢Δ
࣮ͱͯ͠SimpleCovͷ ϓϥάΠϯ 🛤 (ͨͩ͠SimpleCovʹϓϥάΠϯͳͲͱ͍͏֓೦ ͳ͍)
ࠈͷϞϯΩʔύον 🛤 ͦ͏͍͍͓͑ͪ͏ SimpleCov ͷίϛολʔͰ ͋ΔͷͰɺ֦ு͕͍͢͠Α͏ʹϑΟʔυόοΫ͙ Β͍͍͖͍ͯͨ͠
RubyͷCoverageϞδϡʔϧΛ ར༻
͖͔͚ͬ 🛤 ANDPADࣾͷͦͦ͜͜ͷنͷطଘΞϓϦʹࢀը ͯ͠ɺʮ͜ͷίʔυͲͷspecϑΝΠϧ͔Βςε τ͞ΕͯΔΜͩΖ͏ʁʯͱ͔ɺٯʹʮ͜ͷspec Ͳ͜ΒΜͷϑΝΠϧΛςετͯ͠ΔΜͩΖ͏ʯͱ ͔Γͨ͘ͳͬͨͷͰ
application_controller͚ͩͰ300ݸͱ͔͋Δ ͷͰɺͬͺ͜͏͍͏ͷ͕Γͨ͘ͳΔΜͰ͢Α
Ξτϓοτྫ
͔͠͠ɺgem·ͩͳ͍…… 🛤 HTML͕ڊେԽͨ͠߹ͷύϑΥʔϚϯε͕ ͍ͤͯͳ͍ 🛤 ໊લ͕ܾ·͍ͬͯͳ͍ʂ
୭໊͔͍͍લΛ͚͍ͭͯͩ͘͞ 🛤 ͓ئ͍͠·͢
Coming Soon...💎
࠷ۙͷ͓ࣄؔ࿈Ͱ࡞ͬͨͷΛ ͏1ͭ
💎 lightweight_attributes
lightweight_attributes 🛤 Active RecordͷϞσϧͷΠϯελϯεੜΛۃྗ ܰ͘͢ΔͨΊͷ͑͛ͭͳ͍ϞϯΩʔύον
ARͷϞσϧͷΠϯελϯεੜ 🛤 AR 4͙Β͍Ͱೖͬͨtype castingͱ͔͍͏୭ͬͯͳ ͍ػೳͷͨΊʹٸܹʹॏͨ͘ͳͬͨ 🛤 ͱʹ͔͘DB͔ΒϞσϧΛΨόοͱҾͬுͬͯฦ͚ͩ͢Έͨ ͍ͳAPIͱ͔ͩͱɺ͕͜͜ϘτϧωοΫʹͳΔ 🛤
RubyϨϕϧͰɺಛʹTimeతͳͭͷparse͕͔ͬͨ Γ͢Δ
RubyͰTimeతͳͭͷparse͕ ͘ͳΔͱ͍͍ͳ͊ 🛤 https://bugs.ruby-lang.org/issues/16005
https://bugs.ruby-lang.org/ issues/16005
ͱ͋Εɺ lightweight_attributes ʹ͍ͭͯ
sponsored by ΞΧπΩ 🛤 ࠓ͔Βnobuͷύτϩϯʹͳͬͨ͋ͷΞΧπΩࣾ Ͱ͢ʂ
ίʔυ͕͑͛ͭͳ͗ͯ͢͞ ϝϯςෆೳ 🛤 ͜ͷΜͷίʔυRailsͷόʔδϣϯ͝ͱʹͥΜ ͥΜҧͬͯͯɺෳόʔδϣϯରԠͱ͔Ϛδແཧ
ͱ͍͏͜ͱͰɺ·ͱʹϝϯς ͞Εͯͳ͍ͷͰར༻ඇਪ
type castingΛԆͤ͞Δͱ͍͏ ΞΠσΞ 🛤 kamipo͞Μ͕͏·͍͜ͱरͬͯActive Record 6.1ʹίϛοτͯ͘͠Ε͔ͨΒ͏͓ଂೖΓͰ͍͍͔ ͳ……
Rails 6.1
Coming Soon...💎
ΞΧπΩ͞ΜεϙϯαʔͰ͏1ͭ
💎 activerecord-ruby (unreleased) 🛤 ΞϓϦதͰߋ৽͞Εͳ͍͜ͱ͕લఏͷ͍ΘΏΔ ʮϚελʔσʔλʯΛΠϯϝϞϦʹల։ 🛤 ARͷΦϒδΣΫτͷ··Ωϟογϡ͢Δ 🛤 readonlyͳͷͰ҆৺͍ͯ͠ճͤΔ
ૂ͍ 🛤 ΫΤϦͷແବଧͪΛ੍ 🛤 ARͷΦϒδΣΫτੜίετΛݮ 🛤 GCෛՙΛܰݮ
͜͜·ͰͳΒ୭͕ߟ͑ͨ͜ͱ͋Δͱࢥ͏ Μ͚ͩͲɺΠϯλʔϑΣΠεͱ࣮͕ 🛤 Model.fetch_from_cache ͱ͔ͦ͏͍͏ײ͡ͷ μα͍ίʔυઈରॻ͖ͨ͘ͳ͍ 🛤 ϓϩμΫγϣϯͷίʔυ;ͭ͏ͷARͷίʔυ͔Β Կม͑ͣʹɺͰͲͷϞσϧ͕ʮϚελʔςʔϒ ϧʯ͔͚ͩڭ͑ͯͬͨΒউखʹۭؾΛಡΜͰಈ࡞
͢Δ͙Β͍͕͍͍
activerecord-ruby ͷAPI 🛤 ʮϚελʔʯͬΆ͍ϞσϧʹҎԼͷΑ͏ͳએݴΛ ೖΕΔ class Country < ActiveRecord::Base find_by_ruby!
end
ͦΕ͚ͩ 🛤 ଞͷίʔυҰ͍͡Βͳͯ͘ɺҎԼͷΫΤϦͨ ͕ͪDBΛݺͼग़͢͜ͱͳ͘దͳΛฦ͢ Model.find(id) Model.where(prefecture: 'Tokyo').order(:created_at)
joins͕ೖͬͯͨΓ͢ΔΑ͏ͳෳࡶͳΫΤϦ ͕͛ΒΕͨΒDBʹϑΥʔϧόοΫ͢Δ
ϝϞϦ͔Βऔ͖ͬͯͨͷͱDB͔Βऔ͖ͬͯͨ ͷʹᴥᴪ͕ͳ͍͔Ͳ͏͔ൺֱ͢ΔϞʔυΛࡌ 🛤 ςετΛ͜ΕͰճ͓ͯ͘͠ͱ҆৺Ͱ͖Δͣ
ύϑΥʔϚϯεήΠϯ 🛤 ະ 🛤 ਖ਼ͳͱ͜Ζɺ·ͱͳ࣮ΞϓϦͰͷޮՌݶఆత ͳ༧ײ͍ͯ͠Δ 🛤 DBͷଓ͕ύοπϯύοπϯΈ͍ͨͳڥͰ ޮ͔͘
ݟͲ͜Ζ 🛤 ARͷΠϯλʔϑΣΠεͱγʔϜϨεʹ࿈ܞ͢ΔͨΊ ͷςΫχοΫ
࣮ৄࡉ 🛤 AR͕ΈཱͯͨASTΛSQLͰͳͯ͘Rubyͷ ίʔυʹม͢Δ ToRuby visitor ΛΰϦΰϦ࣮
gem·ͩͳ͍
Coming Soon...💎
ࠓ·Ͱʹແ͔ͬͨΞϓϩʔνͩ͠ɺίʔυ͔ ͳΓ͓͠Ζ͍ͷͰɺੈʹग़ͨΞΧπΩʹͥͻ ͍ͬͯ͡Έ͍ͯͩ͘͞
ઌߦݚڀ 🛤 arel_ruby
💎 arel_ruby 🛤 https://github.com/amatsuda/arel_ruby 🛤 (2012)
ArelͷASTͷRuby visitor 🛤 ͭ·ΓɺࠓճͷϓϩμΫτͷΤϯδϯ෦ͦͷͷ
͜Ε࣌ɺRDB͔ΒΓͯ͠Rubyͷੈք͚ͩ ͰΞϓϦͷςετ͕࣮ߦͰ͖ͨΒ͓͠Ζ͍͔ɺ ͱࢥͬͯͬͯΈͨͷ 🛤 ͋·Γݱ࣮తͳϢʔεέʔεͰͳ͔ͬͨͷͰɺ ୯ʹ໘നͦ͏͔ͩΒ࡞ͬͯΈ͚ͨͩΈ͍ͨͳײ͡ʹ ͳͬͯ͠·ͬͨ 🛤 ͦͯͣͬ͠ͱ͓ଂೖΓ
ίʔυॻ͚ͯϢʔεέʔε Λݟޡͬͨྫ
8ܦͬͯɺ৽ͨͳϢʔεέʔεΛ ݟ͚ͭͯ෮׆
͜Μͳ;͏ʹxxܦ͔ͬͯΒੲॻ͍ͨ ίʔυͷժ͕ग़ͨΓ͢Δ͜ͱ͋Δ 🛤 ίʔυΛॻ͖ଓ͚ͯΔͱΞυόϯςʔδ͕͋ͬ ͨΓ͢Δɺͱ͍͏ࣄྫ
·ͱΊ
ͬͺRails 🛤 RailsΛ͍ͬͺ͍ಡΜͩΓॻ͍ͨΓ͍ͯ͠ΔͱRails ʹৄ͘͠ͳΔ
͍ͭͰͲ͜Ͱૉૣ͘ ύονΛॻ͜͏ 🛤 Railsʹৄ͘͠ͳΔͱɺRails͚ͩ͡Όͳ͍ͯ͘ΖΜ ͳͷʹύον͕ॻ͚ΔΑ͏ʹͳΔ 🛤 gem-srcΛrbenvbundlerͱ࿈ܞ͓͍ͤͯͯ͞ɺ ৗʹ࠷खॱͰύονΛ͚͛ͭΕΔ४උΛ͑ͯ ͓͜͏
ͱʹ͔ͨ͘͘͞Μ ύονΛॻ͜͏ 🛤 ύονΛͨ͘͞Μॻ͔ͳ͍ͱɺύον͕ॻ͚Δ Α͏ʹͳΒͳ͍ 🛤 ྔ͕࣭ʹస͡Δ͜ͱ͋Δ
gem࡞Ոͷಓ 🛤 ͍ΖΜͳͷʹύονΛॻ͍ͯΔͱɺଞਓʹॻ͔ͤ ΔΑΓࣗͰॻ͍ͨ΄͏͕ྑ͍ͷ͕Ͱ͖Δ͜ͱ͕ Θ͔Δ 🛤 ͖͔͚ͬϢʔεέʔεΛ͔ͭ·͑ͯɺϓϩμΫτ ʹ͍ͯ͜͠͏
ͦΜͳΜ୭Ͱࢥ͍ͭ͘Ͱ͠ΐɺΈ͍ͨ ͳgemͰͱʹ͔ͬͯ͘ΈΔͱྑ͍ 🛤 ҙ֎ͱ୭Ζ͏ͱͯ͠ͳ͔ͬͨΓɺ͕ࣗੈքͰ Ұ൪͏·͘ΕͨΓ͢Δ
໊લॏཁ 🛤 ໊લ͚ͭΔͷΉ͍ͣ 🛤 ໊લ͕͚ͭΕͳͯ͘ࠓͷൃදʹؒʹ߹Θͳ͔ͬͨ ͷ͕͍͔ͭ͋͘ΔͷͰɺ୭͔Ұॹʹ໊લΛߟ͑ͯ ΄͍͠……
gemͷख़ 🛤 ࡞ͬͨgem͙͢ʹժ͕ग़ͳͯ͘ɺޙ͔ΒϢʔε έʔε͕͍͖ͭͯͯɺԿܦ͔ͬͯΒʹཱͬͨ Γ͢Δ 🛤 ͷͰɺͬͺΓΞΠσΞΛ͖ͪΜͱίʔυʹམͱ͠ ͓ͯ͘͜ͱ͕େࣄ
ϝϯς 🛤 gemΛ͍ͬͺ͍࡞ͬͨΓͯ͠Δͱɺϝϯςର͕ ૿͑͗ͯ͢ख͕ճΒͳ͘ͳΔ 🛤 ͖ͦͦͬΆ͍ਖ਼֬ͳͷͰϝϯςͱ͔ۤख…… 🛤 ͳͷͰɺ୭͔ϝϯςखͬͯ͘ΕΔͱͱͯخ͠ ͍……
Future Works 🛤 ࠓޙͱɺԿ͔ϓϩμΫτͷΞΠσΞ͕͖߱ͬͯͨ Βɺϲ݄ʹ1ճ͙Β͍ͷϖʔεͰgemΛ࡞Γଓ͚ ͍ͨ 🛤 @amatsuda ͷ࣍ճ࡞ʹ͝ظ͍ͩ͘͞ʂ
Coming Soon! 💎
·ͱΊ 🛤 গ͠Ͱօ͞Μͷ͜Ε͔ΒͷOSS׆ಈͷώϯτʹ ͳ͍ͬͯΕ͍Ͱ͢
end 🛤 name: Akira Matsuda 🛤 GitHub: @amatsuda 🛤 Twitter:
@a_matsuda