Slide 1

Slide 1 text

Rails͸Rubyͩ @yoppiblog Aktsuki.inc 12೥5݄30೔ਫ༵೔

Slide 2

Slide 2 text

001 12೥5݄30೔ਫ༵೔

Slide 3

Slide 3 text

Input Output ここ! 12೥5݄30೔ਫ༵೔

Slide 4

Slide 4 text

Input Output 12೥5݄30೔ਫ༵೔

Slide 5

Slide 5 text

Object Oriented Programming w ϞδϡʔϧੑΛҙࣝ͢Δ w ֦ுੑ w ࠶ར༻ੑ w ͢΂ͯ͸඼࣭޲্ͱӡ༻อकͷͨΊ 12೥5݄30೔ਫ༵೔

Slide 6

Slide 6 text

)PX 12೥5݄30೔ਫ༵೔

Slide 7

Slide 7 text

Testable Code • ςετΛॻ͘͜ͱͰڧ੍తʹϞδϡʔϧ Λҙࣝ͢Δ͜ͱʹͳΔ • ΠϯλϑΣʔεઃܭྗΛ਎ʹ͚ͭΔ 12೥5݄30೔ਫ༵೔

Slide 8

Slide 8 text

Rails͸Ruby 12೥5݄30೔ਫ༵೔

Slide 9

Slide 9 text

Ruby application • bin/ • lib/ • spec/ • Rakefile • Gemfile • ... 12೥5݄30೔ਫ༵೔

Slide 10

Slide 10 text

Rails Application • app/ • lib/ • config/ • db/ • spec/ • Rakefile • Gemfile 12೥5݄30೔ਫ༵೔

Slide 11

Slide 11 text

lib/ 12೥5݄30೔ਫ༵೔

Slide 12

Slide 12 text

• RubyΞϓϦͷࠜװͱͳΔ෦෼ • RailsΞϓϦͰ͸monkey patchίʔυ΍ gemͷ֦ுίʔυɺϩδοΫϞδϡʔϧ Λઃஔ͢Δ lib/ 12೥5݄30೔ਫ༵೔

Slide 13

Slide 13 text

case study 12೥5݄30೔ਫ༵೔

Slide 14

Slide 14 text

KingΠϕϯτ • Ϙεότϧ • ใु • ϙΠϯτ෇༩ 12೥5݄30೔ਫ༵೔

Slide 15

Slide 15 text

event_king • lib/event_king.rb • lib/event_king/ • battle.rb • gift.rb • point.rb • spec/lib/event_king/ 12೥5݄30೔ਫ༵೔

Slide 16

Slide 16 text

# lib/event_king.rb module EventKing require 'event_king/battle' require 'event_king/gift' require 'event_king/point' end module loader 12೥5݄30೔ਫ༵೔

Slide 17

Slide 17 text

ότϧ # lib/event_king/battle.rb module EventKing class Battle def initialize(deck, boss) ... end def battle! ... end end end 12೥5݄30೔ਫ༵೔

Slide 18

Slide 18 text

ใु # lib/event_king/gift.rb module EventKing class Gift def initialize(status) ... end def distribute ... end end end 12೥5݄30೔ਫ༵೔

Slide 19

Slide 19 text

ϙΠϯτ෇༩ # lib/event_king/point.rb module EventKing class Point def initialize(status) ... end def distribute ... end end end 12೥5݄30೔ਫ༵೔

Slide 20

Slide 20 text

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 12೥5݄30೔ਫ༵೔

Slide 21

Slide 21 text

·ͱΊ • Rails͸RubyΞϓϦέʔγϣϯͷͻͱͭ • testableͳίʔυΛॻ͘͜ͱͰશମͷ඼ ࣭Λอͪͭͭӡ༻ָ͕ʹͳΔ • ϦϑΝΫλϦϯάΛڪΕͳ͍ • ςετॻ͖·͠ΐ͏ 12೥5݄30೔ਫ༵೔

Slide 22

Slide 22 text

ࢀߟจݙ • ΦϒδΣΫτࢦ޲ೖ໳ ্/Լ • ॳΊͯͷRuby • Ruby ϕετϓϥΫςΟε • ਺ଟ͋ΔΦʔϓϯιʔεͷίʔυ 12೥5݄30೔ਫ༵೔