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
yoppi
December 13, 2012
Programming
0
240
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
760
solving of multi-armed bandit problem in advertisement recommendation
yoppi
2
7.5k
recommendation system with document similarity
yoppi
0
3.2k
Other Decks in Programming
See All in Programming
GitHub Copilot for Azureを使い倒したい
ymd65536
1
200
ComposeでのPicture in Picture
takathemax
0
120
Enterprise Web App. Development (1): Build Tool Training Ver. 5
knakagawa
1
120
Ruby on Railroad: The Power of Visualizing CFG
ydah
0
250
一緒に働きたくなるプログラマの思想 #QiitaConference
mu_zaru
75
18k
Building Scalable Mobile Projects: Fast Builds, High Reusability and Clear Ownership
cyrilmottier
2
320
MCP調べてみました! / Exploring MCP
uhzz
2
2.3k
AWS で実現する安全な AI エージェントの作り方 〜 Bedrock Engineer の実装例を添えて 〜 / how-to-build-secure-ai-agents
gawa
8
880
The Evolution of the CRuby Build System
kateinoigakukun
0
730
プロダクト横断分析に役立つ、事前集計しないサマリーテーブル設計
hanon52_
2
490
エンジニアが挑む、限界までの越境
nealle
1
290
note の Elasticsearch 更新系を支える技術
tchov
0
160
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
40
7.2k
What's in a price? How to price your products and services
michaelherold
245
12k
Why Our Code Smells
bkeepers
PRO
336
57k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.4k
Faster Mobile Websites
deanohume
306
31k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Site-Speed That Sticks
csswizardry
5
500
Thoughts on Productivity
jonyablonski
69
4.6k
Statistics for Hackers
jakevdp
798
220k
How GitHub (no longer) Works
holman
314
140k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
Build The Right Thing And Hit Your Dates
maggiecrowley
35
2.7k
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ਫ༵