Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
rbs-inlineを使ってみた
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
a_fujisaki
September 12, 2024
Programming
1.1k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
rbs-inlineを使ってみた
a_fujisaki
September 12, 2024
More Decks by a_fujisaki
See All by a_fujisaki
自作マクロと型生成
aki19035vc
0
67
rails newと同時に型を書く
aki19035vc
6
1.3k
“Rails × 型”での2年間を振り返る
aki19035vc
2
1.3k
Emacs × LSP × Steep
aki19035vc
0
310
MiniMagickの型を生成したい
aki19035vc
0
180
最近追加した型の紹介とその振り返り
aki19035vc
0
930
Other Decks in Programming
See All in Programming
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
330
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
240
SODA - FACT BOOK(EN)
sodainc
1
220
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
160
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
4
3.8k
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
210
AI-Powered Domain-Driven Design
ziobrando
0
420
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
290
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
310
Getting Started with Vibe Coding
miccheng
0
190
Distance field of Julia set
kinakomoti321
0
310
Next.js: The final boss of Web Performance
guaca
0
390
Featured
See All Featured
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
370
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
520
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
440
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Practical Orchestrator
shlominoach
192
12k
The Cult of Friendly URLs
andyhume
79
7.1k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.9k
First, design no harm
axbom
PRO
2
1.4k
Exploring anti-patterns in Rails
aemeredith
4
560
The Limits of Empathy - UXLibs8
cassininazir
2
770
The untapped power of vector embeddings
frankvandijk
2
2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
Transcript
rbs-inlineを使ってみた Roppongi.rb#22 <2024-09-12> @aki19035vc
自己紹介 ❏ 藤崎 亮人 (a_fujisaki) ❏ @aki19035vc ❏ イタンジ株式会社 ❏
不動産会社向けのSaaSを提供 ❏ バックエンドエンジニア ❏ ほぼRails・たまにScala ❏ 物件基盤の開発責任者 ❏ Rails × 型 の話が好き ❏ 学生の頃(2016年くらい)からEmacs使ってます
今日話すこと ❏ rbs-inline を使ってみた話 ❏ どんな風に試したか ❏ 実際どうだったか (感想) ❏
良かったところ・気になったところなど ❏ 今後やること ※ rbsとかrbs-inlineとかsteepとかの詳しい解説はしません
rbs-inlineとは ❏ Rubyの型情報をソースコード内にコメントとして直接記述することで、 rbsファイルを別途作成せずに型情報を生成できるツール ❏ 詳しくはリポジトリとかRubyKaigi 2024 のセッションを見てください ❏ https://github.com/soutaro/rbs-inline
❏ https://rubykaigi.org/2024/presentations/soutaro.html
簡単な例
どんな風に試したか ❏ rbs_mini_magickという自作gemの型をrbs-inlineで生成するように変更 ❏ https://github.com/aki19035vc/rbs_mini_magick ❏ 元々はrbsとyardをどちらも書いていたため大変だった ❏ 今回は、全て手作業で rbs-inlineを使う形に書き写した
❏ 使用感とかを確かめるために頑張った ❏ rbsファイルをちゃんと書いていたので、そこからrbs-inlineのコメントを 機械的に付与することも検討はした ❏ yardコメントは全部消した
どうだったか (感想) ❏ コード内に型を直接書けるのは素晴らしい ❏ 今まではコードを書き終えた後、最後にまとめて型を書いてた ❏ rbs-inlineを使うと、コードを書くと同時にrbsを書けて効率が良い ❏ 機能的に足りないものなどは特になかった
❏ wikiに書き方が詳しく載っていたので特に困ることもなかった ❏ https://github.com/soutaro/rbs-inline/wiki/Syntax-guide
悩んでいること・気になること ❏ 書き方 ❏ `@rbs` を基本的に使い、attr_xxx, 定数などは `#:` で書くようにした ❏
yardスタイルの書き方はしない ❏ `#:`で統一しようかは迷っている ❏ 書き方を統一させるためのrubocopがあると嬉しい (rubocop-rbs-inline的な) ❏ rubocopで怒られる部分はひとまず無効化した ❏ rubocopにPRを出してくれる方がいるので、無事取り込まれれば無効化しなくても良くな りそう ❏ コード内に記述したrbsコメントが、生成後のrbsファイルにも含まれている ❏ 特に害はないが、なくても良いのでは?とは思った
今後の話 ❏ 業務で開発しているRailsアプリケーションにrbs-inlineを入れる予定 ❏ 型は(ほぼ)100%書いてある ❏ 人力で書き写すのは現実的ではない ❏ 既存のrbsからrbs-inlineのコメントを機械的に付与するスクリプトを作る予定 ❏
上手くいったら弊社のエンジニアブログで公開するつもり & LTもどこかでやり ます