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
57
rails newと同時に型を書く
aki19035vc
6
1.3k
“Rails × 型”での2年間を振り返る
aki19035vc
2
1.2k
Emacs × LSP × Steep
aki19035vc
0
290
MiniMagickの型を生成したい
aki19035vc
0
170
最近追加した型の紹介とその振り返り
aki19035vc
0
910
Other Decks in Programming
See All in Programming
The Rails Doctrine Decade
koic
2
200
JRuby: Past, Present, and Future
headius
0
170
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
2
290
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
7.9k
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
250
選挙速報を多くのユーザーへ 届ける Live Activities 設計
hamayokokuririn
0
150
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
130
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.4k
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
480
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
380
Webの地図
yosuke_furukawa
PRO
6
4.7k
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
410
Featured
See All Featured
Paper Plane
katiecoart
PRO
4
53k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Unsuck your backbone
ammeep
672
58k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
A designer walks into a library…
pauljervisheath
211
25k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
500
Designing for Performance
lara
611
70k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
420
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
320
The untapped power of vector embeddings
frankvandijk
2
1.9k
YesSQL, Process and Tooling at Scale
rocio
174
15k
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もどこかでやり ます