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
RailsはRubyだ
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
yoppi
December 13, 2012
Programming
280
0
Share
RailsはRubyだ
Railsアプリを作るときにlibを意識しようという話を社内でしました。
yoppi
December 13, 2012
More Decks by yoppi
See All by yoppi
Applying oCPC algorithm for production
yoppi
2
830
solving of multi-armed bandit problem in advertisement recommendation
yoppi
2
8.1k
recommendation system with document similarity
yoppi
0
3.3k
Other Decks in Programming
See All in Programming
色即是空、空即是色、データサイエンス
kamoneggi
1
250
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
1
680
AIとRubyの静的型付け
ukin0k0
0
480
Talking to terminals (and how they talk back) (KotlinConf 2026)
jakewharton
PRO
1
160
tsserverとは何だったのか、これからどうなるのか
nowaki28
1
430
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
110
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
320
Copilot CLI の継戦能力を高める コンテキスト管理
nozomutu
1
1.1k
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
390
ECR拡張スキャンでSBOMを収集して サプライチェーン攻撃の影響調査を 爆速で終わらせてみた
akihisaikeda
2
210
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
0
250
AI時代の仕事技芸論 — ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ
kuranuki
1
550
Featured
See All Featured
Marketing to machines
jonoalderson
1
5.3k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
130
Visualization
eitanlees
152
17k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
220
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.3k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
170
Raft: Consensus for Rubyists
vanstee
141
7.5k
4 Signs Your Business is Dying
shpigford
187
22k
Being A Developer After 40
akosma
91
590k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
150
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Transcript
RailsRubyͩ @yoppiblog Aktsuki.inc 125݄30ਫ༵
001 125݄30ਫ༵
Input Output ここ! 125݄30ਫ༵
Input Output 125݄30ਫ༵
Object Oriented Programming w ϞδϡʔϧੑΛҙࣝ͢Δ w ֦ுੑ w ࠶ར༻ੑ w
্࣭ͯ͢ͱӡ༻อकͷͨΊ 125݄30ਫ༵
)PX 125݄30ਫ༵
Testable Code • ςετΛॻ͘͜ͱͰڧ੍తʹϞδϡʔϧ Λҙࣝ͢Δ͜ͱʹͳΔ • ΠϯλϑΣʔεઃܭྗΛʹ͚ͭΔ 125݄30ਫ༵
RailsRuby 125݄30ਫ༵
Ruby application • bin/ • lib/ • spec/ • Rakefile
• Gemfile • ... 125݄30ਫ༵
Rails Application • app/ • lib/ • config/ • db/
• spec/ • Rakefile • Gemfile 125݄30ਫ༵
lib/ 125݄30ਫ༵
• RubyΞϓϦͷࠜװͱͳΔ෦ • RailsΞϓϦͰmonkey patchίʔυ gemͷ֦ுίʔυɺϩδοΫϞδϡʔϧ Λઃஔ͢Δ lib/ 125݄30ਫ༵
case study 125݄30ਫ༵
KingΠϕϯτ • Ϙεότϧ • ใु • ϙΠϯτ༩ 125݄30ਫ༵
event_king • lib/event_king.rb • lib/event_king/ • battle.rb • gift.rb •
point.rb • spec/lib/event_king/ 125݄30ਫ༵
# lib/event_king.rb module EventKing require 'event_king/battle' require 'event_king/gift' require 'event_king/point'
end module loader 125݄30ਫ༵
ότϧ # lib/event_king/battle.rb module EventKing class Battle def initialize(deck, boss)
... end def battle! ... end end end 125݄30ਫ༵
ใु # lib/event_king/gift.rb module EventKing class Gift def initialize(status) ...
end def distribute ... end end end 125݄30ਫ༵
ϙΠϯτ༩ # lib/event_king/point.rb module EventKing class Point def initialize(status) ...
end def distribute ... end end end 125݄30ਫ༵
Controller # app/controller/ user_event_king_boss_battle_logs.rb require ‘event_king’ class UserEventKingBossBattleLogsController def create
... battle = EventKing::Battle.new(deck, boss) battle.battle! log = Log.create(battle) ... end end 125݄30ਫ༵
·ͱΊ • RailsRubyΞϓϦέʔγϣϯͷͻͱͭ • testableͳίʔυΛॻ͘͜ͱͰશମͷ ࣭Λอͪͭͭӡ༻ָ͕ʹͳΔ • ϦϑΝΫλϦϯάΛڪΕͳ͍ • ςετॻ͖·͠ΐ͏
125݄30ਫ༵
ࢀߟจݙ • ΦϒδΣΫτࢦೖ ্/Լ • ॳΊͯͷRuby • Ruby ϕετϓϥΫςΟε •
ଟ͋ΔΦʔϓϯιʔεͷίʔυ 125݄30ਫ༵