Upgrade to Pro — share decks privately, control downloads, hide ads and more …

front act of tochigi ruby kaigi 07

front act of tochigi ruby kaigi 07

ドラフト版から変化なし!

40f4d1f2e77078955bd01e9fb4a503ba?s=128

seki at druby.org

August 26, 2017
Tweet

Transcript

  1. RubyͰͭ͘ΔΧʔυήʔϜ seki@ruby-lang.org

  2. slide sponsors ְאַせ〢㾊3VCZ⠓陽ח⿫⸇׃׋ְ㖑⯋孖זךד!JXBEPO E3VCZח״׷ⴓ侔٥8FCفؚٗٓىؚٝ ؔ٦ي爡F#PPL4UPSF  IUUQFTUPSFPINTIBDPKQUJUMFT1!IJTBTIJN 窫额寸皾⚥!BXB[FLJ ࢲͷ3VCZ,BJHJࢀՃඅ༻ͷεϥΠυεϙϯαʔΛืू͍ͯ͠·͢ɻ

  3. @m_seki فٗך⵸䏟 せ〢㾊דכ溪䩧 衼⡲

  4. 2005 - ·ͩॳ࡮Γങ͑·͢ dRuby ʹΑΔ ؔকढ़ஶ ෼ࢄ ɾ Web ϓϩάϥϛϯά

  5. 2012 (-2014 ઈ൛)

  6. 2017 Web൛ʹͯ͠์ྲྀ ⰕꟚ儗ך׫鑧겗ח

  7. ఻આ্ͷଘࡏ -FBSOGSPNMFHFOEBSZ+BQBOFTF3VCZ IBDLFS .BTBUPTIJ 4FLJ JO UIJT STU &OHMJTI MBOHVBHF

    CPPL PO IJT PXO %JTUSJCVUFE 3VCZ MJCSBSZ :PVMMOEPVUBCPVUEJTUSJCVUFEDPNQVUJOH BEWBODFE 3VCZDPODFQUTBOEUFDIOJRVFT BOEUIFQIJMPTPQIZPG UIF3VCZXBZTUSBJHIUGSPNUIFTPVSDF
  8. History of dRuby 1999-3 ERB 1999-9 DRb 2003 committer 2010

    pokemon-master 2000 Rinda 1998 started ruby 2006 - 2011 Ruby Kaigi MFHFOEBSZ
  9. 2010 ಢ໦୅ද ؕ٦س鿇Ꟍوأة٦ٔ٦ؚ ֶַ־דְְֿהָ֮׏׋

  10. ΧʔυήʔϜͷϨϏϡʔ ず➂ؕ٦س؜٦يךٖؽُ٦ 鑐麇׾⣛걾ׁ׸׋ ׻٦ְ

  11. ໰୊ 暟椚晛ؕ٦س؜٦يכת׌㾈ַזְ הְֲַ⳿勻♳ָ׏גַ׵דכֶ׉ְ

  12. ղܾ 暟椚晛ָזְז׵⟎䟝晛׾אֻ׹ֲ ؒٝسِ٦ؠ٦ぢֽדכזֻծٕ٦ٕװ ؜٦يغٓٝأָ׻ַ׷玎䏝ך׮ך

  13. Ͱ͖ͨ ➙傈כ׉ךرؠ؎ٝ׾铡僇׃׋ְ ⡲䧭麓玎׮ֶ׮׃׹ְָ⵸䏟זךד荈ꅾ

  14. આ໌ॻʢಋೖʣ

  15. આ໌ॻʢ৔ͷΑ͏͢ʣ

  16. ͦ͜Ͱങ͑Δ ➙傈顠ִתׅկ

  17. σϞ

  18. ࣮૷ʹ͍ͭͯ 4JOHMF1BHF"QQMJDBUJPO )5.-ך圓䧭 +4ה"1* 3VCZ⩎

  19. SPA ل٦آ鼂獳ז׃ ؕ٦س׾乼⡲ׅ׷׋ןծ倜׃ְ㜥ך朐䡾׾ +40/ד《䖤׃ծ鋅׋湡׾刿倜ׅ׷

  20. DOM໦ NFOV GJFME 卐ⴓךJNH銲稆 QSPNQU

  21. 60ຕ෼ͷimgཁૉ

  22. 60ຕ෼ͷimgཁૉ ؕ٦سָ㜥ךוֿח㾩ׅךַ̔朐䡾 ؜٦ي⚥ךؕ٦سך侧כ♶㢌 ؕ٦س侧ⴓךJNH銲稆 朐䡾ח䖞ְծJNH銲稆ך㾩䚍װTUZMF׾㢌刿

  23. ঢ়ଶ as JSON 㜥׾邌植׃׋.BQ 㜥䨽ךせ⵸ָؗ٦ 銲稆כؕ٦سךꂁ⴨ 갫䎷ח䠐㄂֮׷ַ׵

  24. ৔ͷΑ͏͢

  25. MapͷΩʔ FOUSBODF DPTUBSFB

  26. JS "1*ך鵤׃׋.BQ׾㜥ח⿾僥ׇׁ׷

  27. ঢ়ଶΛऔಘ var load_state = (function(url) { var x; try {

    ... } if (x) { x.onreadystatechange = function() { if (x.readyState == 4 && x.status == 200) { var state = JSON.parse(x.responseText); apply_state(state); } } x.open("GET", url); x.send(null); } }); 9.-)UUQ3FRVFTUך 鷌㾄זⳢ椚 铣׭׋׵⿾僥
  28. ঢ়ଶΛ৔ʹ൓ө var apply_state = (function ( state ) { put_entrance(state,

    last_state); put_hand(state.hand); put_current(state.current, state.prompt); put_outlet(state.outlet, state.prompt); put_costarea(state.costarea); put_candy(state.candy); put_gift(state.gift); put_map(state.map); put_kanban(state.kanban); put_break(state.break); put_red(state.red); put_yellow(state.yellow); put_blue(state.blue); put_prompt(state); last_state = state; }); 朐䡾 㜥䨽חؕ٦س׾ 縧ֻⳢ椚ך⚛ן
  29. handΛ഑ஔ var put_hand = (function (cards) { var x =

    400, z = 1; cards.forEach( function( name ) { card = document.getElementById('mog-' + name); card.src = image_path(name); card.className = "mog-card mog-shadow" card.style.top = 20; card.style.left = x; card.style.zIndex = z; card.draggable = true; { var url = '/api/?tofu_id=api;tofu_cmd=choose;opt=' + (z - 1); card.onclick = function () { load_state(url); }; }; x = x + 125; z = z + 1; }); }); POMJDL ָ٦׿ ֿ׸׮ֲ⢪׏גזְװא 嶊׃䘌׸ 鋅׋湡ך鏣㹀
  30. costareaΛ഑ஔ var put_costarea = (function (cards) { var y =

    -40, z = 1; cards.forEach( function( name ) { card = document.getElementById('mog-' + name); card.src = image_path("ura"); card.className = "mog-card mog-costarea"; card.style.top = y; card.style.left = 100; card.style.zIndex = z; card.draggable = false; card.onclick = null; z = z + 1; y = y + 2; if ( z % 5 === 1 ) { y = y + 2;} }); }); POMJDL OVMM ؕ٦سכ酅ח
  31. ͦ͏͍͑͹Ruby 䘌׸גתׇ׿ ؟٦غ٦؟؎سכ3VCZ

  32. Ҩ࢈Λར༻ 5PGV 8&#SJDL

  33. Tofu on WEBrick ➙㔐כ8&#SJDLך)551؟٦غ٦ה5PGVד ׋ְגְךהֿ׹חכ鯹׷ה䙼ֲ

  34. ݪॳͷTofu 䎃갦%JW5PGV (6*فؚٗٓىؚٝך״ֲח8FC،فٔ剅 ֹ׋ְ 9דך穗꿀ַ׵ ֶתֽ $(* 8&#SJDLך؎ٝة٦ؿؑ؎أך麩ְ ׾ェ ׅ׷3BDLךכ׷ַ僓זךד

  35. ౰࣌ͷࣗຫ UDMULה8FC،فָٔずׄا٦أ؝٦سד (6*鿇ⴓ׾ה׶ִַ׵׸׷ ְֻאַך8JEHFUإحز

  36. ͍·ͷTofu 8&#SJDLך؎ٝة٦ؿؑ؎أח窟さ إحءّٝך盖椚 ؙٔؒأزךꂁ⥋ ٖأهٝأך穈׫甧ג "1*ה׃ג⢪ֲ׋׭ךꂁ䣁 NJYJד㣐僓ח갭谏ֻ׿ח䭷䶯ׁ׸׋䠐㄂ ָ剑鵚װ׏ה׻ַ׏׋

  37. ϦΫΤετͱϨεϙϯε ؙٔؒأزכ朐䡾׾㢌⻉ׇׁ׷הֹ׮֮׷ ٖأهٝأכ׉ך澓꟦ך剑倜ך朐䡾׾鵤ׅ

  38. ؔ਺Ά͘ͳ͍ طحزٙ٦ؙך鹼䒀ծⱄ鷏ծ醱侧ך歗꬗ ؐ؍ٝسؐծةـַ׵ך乼⡲ծ鸬䩧 ؙٔؒأزָꅾ醱ׅ׷ֿהכ״ֻ֮׷ֿה ꟼ侧שֻ罋ִג醱侧ך朐䡾׾鏩ׅ⚛遤⚅歲 ׮ַ׏ְְֽֿו5PGVכ׉ֲ׃זַ׏׋

  39. API༻ͷWidget class StateTofu < Tofu::Tofu def to_html(context) context.res_header('content-type', 'application/json') body

    = @session.to_hash.to_json context.res_body(body) context.done end def tofu_id 'api' end ٖأهٝأכKTPOדׅ״ せ⵸䝤ְ 8JEHFUך*%
  40. URLͷྫ BQJ UPGV@JEBQJUPGV@DNEDIPPTFPQU var put_hand = (function (cards) { ...

    var url = '/api/?tofu_id=api;tofu_cmd=choose;opt=' + (z - 1); ... 8JEHFUך陎ⴽ㶨 乼⡲ 䒷侧
  41. chooseίϚϯυͷϋϯυϥ def do_choose(context, params) return if @session.finish? deck = @session.deck

    kind, opt = deck.prompt case kind when :spread_else, :outlet_else it ,= params['opt'] num = Integer(it) rescue nil return unless num if (0...(deck.hand.size)) === num card = deck.hand[num] deck.send(kind, card) end end end 䒷侧ךغٔر٦ءّٝ EFDLכְתדֹ׷ֿה׾ 濼׏גְ׷ 朐䡾ך刿倜 EFDLָ؜٦يך朐䡾
  42. Web෦෼͸΋͏͍͍͔ 剑鵚ך➂ךקֲָ׆׏הֲת׉ֲ 罈㹱

  43. ΧʔυήʔϜຊମ ٕ٦ٕ׾鎸鶢ׅ׷鿇ⴓ 7%.  הַ⢪׏גזְ

  44. ग़དྷ্͕͔ͬͯΒݟΕ͹͞ʔ דֹגַ׵鋅׸לֲֿ剅ֻ׃ַזְ׌׹ ה䙼ֲֽוծ罋ִגְ׷꟦כ鑐遤ꐪ铎ָ㢳 ַ׏׋

  45. શମͷϧʔϧ Χʔυݻ༗ͷϧʔϧ ًةٕ٦ٕ؜٦يך崧׸הؕ٦س㔿剣 ךٕ٦ٕח׃ג׫׋ ه؛ؕהַ倜ؕ٦سכ㛇劤ךٕ٦ٕ׾♳ 剅ֹׅ׷״ֲזؕ٦سך鎸鶢לַ׶ ✲⵸ח窟さׁ׸׋ٕ٦ٕכ⡲׸זְ״ֲ ז孡ָׅ׷

  46. ΧʔυΛબΜͩͱ͖ʹ.. ؕ٦س׀החװ׷ץֹֿהך"SSBZ׾䭯א !UPEP 鼅׿׌׵㜥؜٦يחUPEP׾鯄鎸 ؜٦يכֿךUPEP׾갫ח嶊顤׃גְֻ ؜٦يהְֲ7.חفؚٗٓي׾ٗ٦سׅ׷ 䠬ׄ

  47. ͍͔ͭ΍Γ͍ͨ ه؛ؕךرحؗך荈⹛欰䧭

  48. CUI൛ Ꟛ涪䔲ⴱכ$6*晛ך؎ٝة٦ؿؑ؎أ׾⡲ ׶㹋꿀

  49. ࢼ༡ͨ͠ ٕ٦ָٕ然钠דֹ׋ ֽ׏ֲֶֿ׮׃׹ְ

  50. ڽΔ΂͖ͱ͜Ζ ر؝ٖ٦ءّٝחⳔ׷״׶ծ稆傍ְ乼⡲ծ ⽃秪זؙٔحؙזוָ荈ⴓחכ䗳銲 ׉ך穠卓ծⴽך➂ח麇׿ד׮׵ִזַ׏׋

  51. ੒Ռ ⹧׍瘡鋅אֽ׋ ְֻאַךٕ٦ٕך䲿周׾׃ג㹋ꥷח鷄⸇ ׃ג׮׵׏׋

  52. Ծ૝ΧʔυήʔϜͷ໰୊఺ ءٍحؿָٕ蕱חז׵זְ չءٍحؿָٕ㢳ְպٕ٦ٕד֮׷ֿה ָ孡בֹחְֻ

  53. લ࠲͸͜͜·Ͱ 劤箟׾ֶ嚂׃׫ֻ׌ְׁ