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
0
260
RailsはRubyだ
Railsアプリを作るときにlibを意識しようという話を社内でしました。
yoppi
December 13, 2012
Tweet
Share
More Decks by yoppi
See All by yoppi
Applying oCPC algorithm for production
yoppi
2
800
solving of multi-armed bandit problem in advertisement recommendation
yoppi
2
7.9k
recommendation system with document similarity
yoppi
0
3.3k
Other Decks in Programming
See All in Programming
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
180
ゆくKotlin くるRust
exoego
1
210
Fluid Templating in TYPO3 14
s2b
0
110
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
420
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.7k
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
660
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
1.9k
組織で育むオブザーバビリティ
ryota_hnk
0
150
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
180
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.3k
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
.NET Conf 2025 の興味のあるセッ ションを復習した / dotnet conf 2025 quick recap for backend engineer
tomohisa
0
120
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
How to train your dragon (web standard)
notwaldorf
97
6.5k
Unsuck your backbone
ammeep
671
58k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Practical Orchestrator
shlominoach
191
11k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
1
43
Fireside Chat
paigeccino
41
3.8k
The Curious Case for Waylosing
cassininazir
0
220
SEO for Brand Visibility & Recognition
aleyda
0
4.2k
Evolving SEO for Evolving Search Engines
ryanjones
0
110
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
0
97
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ਫ༵