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
YARD with RBS Syntax
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Takumi Shotoku
July 06, 2023
Technology
1
640
YARD with RBS Syntax
【オフライン開催】Omotesando.rb #87
https://omotesandorb.connpass.com/event/287544/
Takumi Shotoku
July 06, 2023
Tweet
Share
More Decks by Takumi Shotoku
See All by Takumi Shotoku
Automatically generating types by running tests
sinsoku
4
13k
滅・サービスクラス🔥 / Destruction Service Class
sinsoku
8
2.7k
テストを書かないためのテスト/ Tests for not writing tests
sinsoku
1
290
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
340
"型"のあるRailsアプリケーション開発 / Typed Rails application development
sinsoku
10
3k
Let's get started with Ruby && Rails Tips
sinsoku
0
480
LTの敷居を下げる / Lower the threshold for LT
sinsoku
2
420
CircleCIの高速化🚀 / CircleCI faster
sinsoku
3
1.5k
Railsアプリと型検査 / Rails app and type checking
sinsoku
5
1.6k
Other Decks in Technology
See All in Technology
Lookerの最新バージョンv26.2がやばい話
waiwai2111
1
150
組織のSREを推進するためのPlatform EngineeringとEKS / Platform Engineering and EKS to drive SRE in your organization
chmikata
0
160
AWS Bedrock Guardrails / 機密情報の入力・出力をブロックする — Blocking Sensitive Information Input/Output
kazuhitonakayama
2
190
20260222ねこIoTLT ねこIoTLTをふりかえる
poropinai1966
0
310
チームメンバー迷わないIaC設計
hayama17
5
3.3k
OCI技術資料 : 外部接続 VPN接続 詳細
ocise
1
10k
パネルディスカッション資料 (at Tableau Now! - 2026-02-26)
yoshitakaarakawa
0
870
LINEアプリ開発のための Claude Code活用基盤の構築
lycorptech_jp
PRO
1
1.1k
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
14k
Databricks (と気合い)で頑張るAI Agent 運用
kameitomohiro
0
340
大規模な組織におけるAI Agent活用の促進と課題
lycorptech_jp
PRO
5
7.3k
Digitization部 紹介資料
sansan33
PRO
1
6.9k
Featured
See All Featured
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
200
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
380
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
280
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.3k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
Facilitating Awesome Meetings
lara
57
6.8k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.5k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
1.9k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
130
Transcript
YARD with RBS Syntax Omotesando.rb #87 2023/07/06 1
ࣗݾհ • ໊લ: ਖ਼ಙ (aka: ਆ) • ձࣾ: - •
GitHub: @sinsoku (ը૾ӈ্) • Twitter: @sinsoku_listy (ը૾ӈԼ) • ͖ͳݴޠ: Rust • Railsྺ: 8͘Β͍ 2
ઌ݄͔ΒRBSΛ͍࢝Ί·ͨ͠ 3
͖͔͚ͬ: MedPeerͷϒϩά 4
ࣾͷ૯ҙ: ܕͷԸܙΛड͚͍ͨ ʢͨͩ͠ܕࣗͰॻ͖ͨ͘ͳ͍ʣ 5
RBSಋೖͷํ • *.rbs ࣗಈੜ͢Δ • rbs collection • rbs prototype
• sord1 ʢYARD -> rbsʣ • gemͷෆͯ͠Δܕఆٛ࠷খݶ͚ͩ༻ҙ 1 https://github.com/AaronC81/sord 6
ಋೖͷৄࡉׂѪʢͨͿΜϒϩάॻ͘ʣ 7
͔͜͜Βຊ 8
Α͋͘ΔYARDͷྫ class User # @param item [Item] ΞΠςϜ # @param
amount [Integer] ྔ # @param coupon [Coupon] Ϋʔϙϯ # @return [Boolean] ߪೖͷޭ/ࣦഊ def buy(item, amount, coupon = nil); end end 9
୭େͨ͠આ໌Λॻ͍͍ͯͳ͍ 10
ීஈܕ͚ͩॻ͚ेͰʁ 2 2 େࣄͳ෦ʹઆ໌Λॻ͚͘ͲɺܕͱҾ໊Ͱेͳέʔεଟ͍ɻ 11
ͦΜͳgemΛ࡞Γ·ͨ͠ 12
! yard-sig https://github.com/sinsoku/yard-sig 13
͜Ε͕ class User # @param item [Item] ΞΠςϜ # @param
amount [Integer] ྔ # @param coupon [Coupon] Ϋʔϙϯ # @return [Boolean] ߪೖͷޭ/ࣦഊ def buy(item, amount, coupon = nil); end end 14
͜͏ͳΔ class User # @!sig (Item, Integer, ?Coupon) -> bool
def buy(item, amount, coupon = nil); end end 15
yard-sig • YARDϓϥάΠϯ • yard doc --plugin sig Ͱ༻Մ3 •
จ๏RBS Syntaxͱಉ͡ • ෦Ͱ @param @return ͳͲͷλάʹม 3 .yardopts ʹ --plugin sig Λࢦఆ͢Δͱָ 16
σϞʢϦϦʔε࡞ۀʣ 17
͓·͚: Rails v7.0.5ͷ has_one ͕ਏ͍ 18
ͷཁ طଘϨίʔυ͕͋Δͱ͖ͷ create_association ͷڍಈ͕มΘΔɻ • v7.0.4: save(validate, INSERT) -> destroy(DELETE)
• v7.0.5: destroy(DELETE) -> save(validate, INSERT) v7.0.4·ͰผʑͷτϥϯβΫγϣϯͰɺόϦσʔγϣϯʹࣦഊ͠ ͯطଘϨίʔυ͕আ͞Ε͍ͯͨɻ 19
Өڹ͕͋Δέʔε 1. Uniquness Validator4 2. UNIQ constraint 3. DBґଘͷCustom Validation
• ྫ: ϨίʔυΛ࡞͔ͯ͠Β10Ҏ 4 v7.0.4ͰόάͬͯΔͷͰɺجຊతʹؾʹ͢Δඞཁ͕ͳ͍ͣɻ 20
rails/rails#48643 21