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

Ruby講義 第7回

Ruby講義 第7回

2012.5.24
Wikipedia アクセス数解析後編
ブロック
リファレンスマニュアル

Kuniaki IGARASHI

May 24, 2012
Tweet

More Decks by Kuniaki IGARASHI

Other Decks in Technology

Transcript

  1. 8JLJQFEJBͷΞΫηε਺ղੳ FODPEJOHVUG SFRVJSFDHJ pMFOBNFKBUYU pMF'JMFPQFO pMFOBNF S65' MJTU<> XIJMFUFYUpMFHFUT CFHJO

    OFYUVOMFTTUFYUd?KB EBUBUFYUTQMJU I\UJUMF$(*VOFTDBQF EBUB<> DPVOUEBUB<>^ MJTUQVTII SFTDVF&YDFQUJPOF QF FOE FOE pMFDMPTF DPVOUॱʹιʔτ SFTVMUMJTUTPSU@CZEPcJc J<DPVOU>UP@J FOE τοϓදࣔ SFTVMUSFWFSTFpSTU  FBDIEPcJc QVUTJ FOE ͜͜·ͰͰ͖·ͨ͠ɻ
  2. ϑΝΠϧ͔Β֤ߦಡΈࠐΈ pMFOBNFKBUYU pMF'JMFPQFO pMFOBNF S65' XIJMFUFYUpMFHFUT QVUTUFYU FOE pMFDMPTF XIJMF৚݅੒ཱத͸܁Γฦ͠

    ͜ͷ৔߹ɺ৚݅͸ UFYUpMFHFUT ʹͳΓ·͢ɻ pMFHFUT ͸ߦಡΈࠐΉϝιου ಡΈࠐΊͨΒਅɺ ϑΝΠϧऴ୺ͰಡΈࠐΊͳ͍ ͱِ OJM ʹͳΓ·͢ɻ UFYUʹߦ໨ͷσʔλ͕ೖͬͯFOE·Ͱॲཧ XIJMFͷߦ΁໭Γɺ UFYUʹߦ໨ͷσʔλ͕ೖͬͯFOE·Ͱॲཧ શߦ܁Γฦ͠ ऴ୺ͰpMFHFUT͢Δͱ৚݅ෆ੒ཱʹͳΓ܁Γฦ͠ऴྃ
  3. OFYUจ XIJMFUFYUpMFHFUT  "  OFYU  #  FOE

    ܁Γฦ͠தʹOFYUจΛॻ͘ͱɺͦΕҎ߱ͷॲ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QVTII SFTDVF&YDFQUJPOF QF FOE FOE pMFDMPTF DPVOUॱʹιʔτ SFTVMUMJTUTPSU@CZEPcJc J<DPVOU>UP@J FOE τοϓදࣔ SFTVMUSFWFSTFpSTU  FBDIEPcJc QVUTJ FOE ࠓि͸͜͜Λઆ໌
  7. 8JLJQFEJBͷΞΫηε਺ղੳ FODPEJOHVUG SFRVJSFDHJ pMFOBNFKBUYU pMF'JMFPQFO pMFOBNF S65' MJTU<> XIJMFUFYUpMFHFUT CFHJO

    OFYUVOMFTTUFYUd?KB EBUBUFYUTQMJU I\UJUMF$(*VOFTDBQF EBUB<> DPVOUEBUB<>^ MJTUQVTII SFTDVF&YDFQUJPOF QF FOE FOE pMFDMPTF DPVOUॱʹιʔτ SFTVMUMJTUTPSU@CZEPcJc J<DPVOU>UP@J FOE τοϓදࣔ SFTVMUSFWFSTFpSTU  FBDIEPcJc QVUTJ FOE ͜͜·ͰͰɺͰ͖ͨ͜ͱ σʔλϑΝΠϧͷ֤ߦΛղੳͯ͠ɺ ݁ՌΛม਺MJTU "SSBZΦϒδΣΫτ ΁٧ΊΔ
  8. ม਺MJTUͷத਎ͷ֓೦ਤ )BTI ΦϒδΣΫτ MJTU "SSBZ ΦϒδΣΫτ ม਺ <\UJUMFΧςΰϦຽ๏ DPVOU^ \UJUMFΨεࣄۀ๏ୈ৚

    DPVOU^ \UJUMFΨϦΞઓه DPVOU^ >  UJUMFΨεࣄۀ๏ୈ৚ DPVOU UJUMFΨϦΞઓه DPVOU UJUMFΧςΰϦຽ๏ DPVOU
  9. DPVOUॱʹฒ΂ม͍͑ͨ ΞΫηε͕ଟ͍ϥϯΩϯάΛݟ͍ͨ )BTI ΦϒδΣΫτ MJTU "SSBZ ΦϒδΣΫτ ม਺ <\UJUMFΧςΰϦຽ๏ DPVOU^

    \UJUMFΨεࣄۀ๏ୈ৚ DPVOU^ \UJUMFΨϦΞઓه DPVOU^ >  UJUMFΨεࣄۀ๏ୈ৚ DPVOU UJUMFΨϦΞઓه DPVOU UJUMFΧςΰϦຽ๏ DPVOU
  10. DPVOUॱʹฒ΂ม͍͑ͨ )BTI ΦϒδΣΫτ MJTU "SSBZ ΦϒδΣΫτ ม਺ <\UJUMFΧςΰϦຽ๏ DPVOU^ \UJUMFΨεࣄۀ๏ୈ৚

    DPVOU^ \UJUMFΨϦΞઓه DPVOU^ >  UJUMFΨεࣄۀ๏ୈ৚ DPVOU UJUMFΨϦΞઓه DPVOU UJUMFΧςΰϦຽ๏ DPVOU <\UJUMFʁʁʁ DPVOU99999^ \UJUMFʁʁʁ DPVOU9999^ \UJUMFʁʁʁ DPVOU999^ >
  11. DPVOUॱʹฒ΂ม͑Δʹ͸ )BTI ΦϒδΣΫτ MJTU "SSBZ ΦϒδΣΫτ ม਺ <\UJUMFΧςΰϦຽ๏ DPVOU^ \UJUMFΨεࣄۀ๏ୈ৚

    DPVOU^ \UJUMFΨϦΞઓه DPVOU^ >  UJUMFΨεࣄۀ๏ୈ৚ DPVOU UJUMFΨϦΞઓه DPVOU UJUMFΧςΰϦຽ๏ DPVOU MJTU "SSBZ ಺ͷத਎ʹ͍ͭͯ DPVOUΛௐ΂ͯฒͼ͔͑Δ
  12. "SSBZTPSU@CZϝιου BSSBZ<  > SFTVMUBSSBZTPSU@CZEPcJc J FOE QSFTVMU "SSBZͷத਎ΛϒϩοΫͷධՁ݁ՌͰฒͼସ͑ <

     > αϯϓϧίʔυ ճ໨JධՁ݁Ռ ճ໨JධՁ݁Ռ ճ໨JධՁ݁Ռ ࣮ߦ݁Ռ
  13. DPVOUॱฒͼସ͑ιʔείʔυ SFTVMUMJTUTPSU@CZEPcJc J<DPVOU>UP@J FOE ճ໨ͷJ\UJUMFΧςΰϦຽ๏ DPVOU^ ճ໨ͷJ\UJUMFΨεࣄۀ๏ୈ৚ DPVOU^ ճ໨ͷJ\UJUMFΨϦΞઓه DPVOU^

    ΋͠΋ม਺MJTU͕ҎԼͷ͔ͭ͠ೖ͍ͬͯͳ͍ͱ͢Δͱ <\UJUMFΧςΰϦຽ๏ DPVOU^ \UJUMFΨεࣄۀ๏ୈ৚ DPVOU^ \UJUMFΨϦΞઓه DPVOU^>
  14. DPVOUॱฒͼସ͑ιʔείʔυ SFTVMUMJTUTPSU@CZEPcJc J<DPVOU>UP@J FOE <\UJUMFΧςΰϦຽ๏ DPVOU^ \UJUMFΨεࣄۀ๏ୈ৚ DPVOU^ \UJUMFΨϦΞઓه DPVOU^>

    <\UJUMFΧςΰϦຽ๏ DPVOU^ \UJUMFΨϦΞઓه DPVOU^ \UJUMFΨεࣄۀ๏ୈ৚ DPVOU^> ม਺MJTU ม਺SFTVMU ͨͩɺ͜ΕͩͱΧ΢ϯτ͕গͳ͍ॱͳͷͰɺޙͰٯॱʹ͠·͢ɻ
  15. TPSU@CZͷԋश "SSBZΦϒδΣΫτ <\OBNFBQQMF QSJDF^ \OBNFHSBQF QSJDF^ \OBNFPSBOHF QSJDF^> ΛQSJDF͕͍҆ॱʹฒͼସ͑ͯදࣔ͢ΔίʔυΛॻ͍͍ͯͩ͘͞ɻ "SSBZΦϒδΣΫτ<

     >Λઈର஋͕খ͍͞ॱʹฒͼସ͑ ͯදࣔ͢ΔίʔυΛॻ͍͍ͯͩ͘͞ɻ ώϯτɿઈର஋ͷऔಘ͸BCTϝιου ʲ্ڃʳ͋Δ"SSBZΦϒδΣΫτ ྫ͑͹<  >ͱ͔<  >ͱ͔ʣ ͕খ͍͞ॱʹฒͼସ͑ࡁΈ͔Ͳ͏͔൑ఆ͢ΔίʔυΛॻ͍͍ͯͩ͘͞ɻ ʲ্ڃʳཁૉʹॏෳͷແ͍"SSBZ ྫɿ<    > ΛTPSU@CZΛ࢖ ͍ɺSFWFSTFͱಉ༷ͷ݁ՌΛಘΒΕΔίʔυΛॻ͍ͯԼ͍͞ɻ
  16. 8JLJQFEJBͷΞΫηε਺ղੳ FODPEJOHVUG SFRVJSFDHJ pMFOBNFKBUYU pMF'JMFPQFO pMFOBNF S65' MJTU<> XIJMFUFYUpMFHFUT CFHJO

    OFYUVOMFTTUFYUd?KB EBUBUFYUTQMJU I\UJUMF$(*VOFTDBQF EBUB<> DPVOUEBUB<>^ MJTUQVTII SFTDVF&YDFQUJPOF QF FOE FOE pMFDMPTF DPVOUॱʹιʔτ SFTVMUMJTUTPSU@CZEPcJc J<DPVOU>UP@J FOE τοϓදࣔ SFTVMUSFWFSTFpSTU  FBDIEPcJc QVUTJ FOE ͕͜͜Ͱ͖ͨ
  17. 8JLJQFEJBͷΞΫηε਺ղੳ FODPEJOHVUG SFRVJSFDHJ pMFOBNFKBUYU pMF'JMFPQFO pMFOBNF S65' MJTU<> XIJMFUFYUpMFHFUT CFHJO

    OFYUVOMFTTUFYUd?KB EBUBUFYUTQMJU I\UJUMF$(*VOFTDBQF EBUB<> DPVOUEBUB<>^ MJTUQVTII SFTDVF&YDFQUJPOF QF FOE FOE pMFDMPTF DPVOUॱʹιʔτ SFTVMUMJTUTPSU@CZEPcJc J<DPVOU>UP@J FOE τοϓදࣔ SFTVMUSFWFSTFpSTU  FBDIEPcJc QVUTJ FOE ͍Α͍Α࠷ޙͷ෦෼
  18. ϥϯΩϯάΛग़͢ઓུ <\UJUMFʁʁʁ DPVOU^ \UJUMFʁʁʁ DPVOU^  \UJUMFʁʁʁ DPVOU999^ \UJUMFʁʁʁ DPVOU9999^

    \UJUMFʁʁʁ DPVOU99999^> <\UJUMFʁʁʁ DPVOU99999^ \UJUMFʁʁʁ DPVOU9999^ \UJUMFʁʁʁ DPVOU999^  \UJUMFʁʁʁ DPVOU^ \UJUMFʁʁʁ DPVOU^> ݱࡏͷม਺SFTVMUͷத਎ DPVOUͷগͳ͍ॱʹιʔτ ͞Εͨ"SSBZΦϒδΣΫτ DPVOUͷଟ͍ॱʹ͍ͨ͠ શཁૉΛٯॱʹ͢Δ
  19. ϓϩ΋࢖͏ݕࡧํ๏ 3VCZͷΦϒδΣΫτʹ௚઀ฉ͘ํ๏΋͋Γ·͢ɻ <>NFUIPET <[JQ QPQ pOE@JOEFY SBTTPD FOVN@TMJDF NBQ 

    NJONBY NFUIPET TFOE TIVGqF SFQMBDF > NFUIPETϝιουͰ࢖͑ΔϝιουҰཡ͕දࣔ͞Ε·͢ɻӳ୯ޠ ͰͳΜͱͳ͘ҙຯ͕෼͔ΔͷͰ͜ΕͰݟ͚ͭΔͱ͖΋ଟ͍Ͱ͢ɻ JSC SFRVJSFQQ QQ<>NFUIPETTPSU QQͱTPSUΛ࢖͏ͱݟқ͍Ͱ͢ɻ
  20. ϥϯΩϯάΛग़͢ઓུ SFWFSTFΛ࢖ͬͯٯॱʹͰ͖·ͨ͠ɻ <\UJUMFʁʁʁ DPVOU99999^ \UJUMFʁʁʁ DPVOU9999^ \UJUMFʁʁʁ DPVOU999^  \UJUMFʁʁʁ

    DPVOU^ \UJUMFʁʁʁ DPVOU^> શ෦දࣔ͢Δͷ͸େมͳͷͰɺઌ಄͚݅ͩऔಘ͍ͨ͠ ઌ಄͔Βݸ ϦϑΝϨϯεϚχϡΞϧͰݕࡧͯ͠Έ·͠ΐ͏ɻ શ෦Ͱ ਺ສߦ
  21. ϥϯΩϯάΛग़͢ઓུ pSTUΛ࢖ͬͯ࠷ॳͷݸΛऔಘͰ͖·ͨ͠ɻ <\UJUMFʁʁʁ DPVOU99999^ \UJUMFʁʁʁ DPVOU9999^ \UJUMFʁʁʁ DPVOU999^ > ݸͷཁૉΛ࣋ͭ"SSBZΦϒδΣΫτ͕Ͱ͖ͨͷͰɺ

    લʹ΍ͬͨFBDIจͰ܁Γฦ͠ॲཧΛߦ͍ɺ ֤ཁૉΛදࣔ͢Ε͹ϥϯΩϯάΛදࣔͰ͖ͦ͏Ͱ͢ɻ Ͱ͸ɺ͜͜·ͰͷॲཧΛͭͳ͛ͯΈ·͠ΐ͏ɻ ઌ಄͔Βݸ
  22. 8JLJQFEJBͷΞΫηε਺ղੳ FODPEJOHVUG SFRVJSFDHJ pMFOBNFKBUYU pMF'JMFPQFO pMFOBNF S65' MJTU<> XIJMFUFYUpMFHFUT CFHJO

    OFYUVOMFTTUFYUd?KB EBUBUFYUTQMJU I\UJUMF$(*VOFTDBQF EBUB<> DPVOUEBUB<>^ MJTUQVTII SFTDVF&YDFQUJPOF QF FOE FOE pMFDMPTF DPVOUॱʹιʔτ SFTVMUMJTUTPSU@CZEPcJc J<DPVOU>UP@J FOE τοϓදࣔ SFTVMUSFWFSTFpSTU  FBDIEPcJc QVUTJ FOE Ͱ͸ɺ࣮ߦͯ͠Έ·͠ΐ͏
  23. "SSBZTPSU@CZϝιου BSSBZ<  > SFTVMUBSSBZTPSU@CZEPcJc J FOE QSFTVMU "SSBZͷத਎ΛϒϩοΫͷධՁ݁ՌͰฒͼସ͑ <

     > αϯϓϧίʔυ ճ໨JධՁ݁Ռ ճ໨JධՁ݁Ռ ճ໨JධՁ݁Ռ ࣮ߦ݁Ռ
  24. TPSU@CZͷԋश ʲ্ڃʳ͋Δ"SSBZΦϒδΣΫτ ྫ͑͹<  >ͱ͔<  >ͱ͔ʣ ͕খ͍͞ॱʹฒͼସ͑ࡁΈ͔Ͳ͏͔൑ఆ͢ΔίʔυΛॻ͍͍ͯͩ͘͞ɻ BSSBZ< 

    > SFTVMUBSSBZTPSU@CZEPcJc J FOE QSFTVMUBSSBZ "SSBZΦϒδΣΫτ͸ԋࢉࢠͰಉ͔͡Ͳ͏͔൑ఆͰ͖·͢ɻ TPSU@CZ͸ର৅ͷΦϒδΣΫτͦͷ΋ͷΛฒͼସ͑ΔͷͰ͸ͳ͘ɺ ର৅ͷΦϒδΣΫτΛฒͼସ͑ͨ৽͍͠ΦϒδΣΫτΛฦ͠·͢ɻ ͳͷͰɺBSSBZͷத਎͸TPSU@CZޙ΋มΘΒͣ<  >Ͱ͢ɻ ର৅ͷΦϒδΣΫτΛฒͼସ͑ΔTPSU@CZϝιου΋͋Γ·͢ɻ ର৅ͷΦϒδΣΫτΛॻ͖׵͑Δϝιου͸ഁյతϝιουͱݺͼɺ ϝιου໊຤ඌʹ͕ͭ͘΋ͷ͕ଟ͍Ͱ͢ɻ
  25. TPSU@CZͷԋश ʲ্ڃʳཁૉʹॏෳͷແ͍"SSBZ ྫɿ<    > ΛTPSU@CZΛ࢖ ͍ɺSFWFSTFͱಉ༷ͷ݁ՌΛಘΒΕΔίʔυΛॻ͍ͯԼ͍͞ɻ BSSBZ<

       > SFTVMUBSSBZTPSU@CZEPcJc BSSBZJOEFY J FOE QSFTVMU BSSBZJOEFY WBMVF ͸BSSBZͷதͷWBMVF͕ೖ͍ͬͯΔҐஔΛฦ͠·͢ɻ <    >JOEFY  ˠ <    >JOEFY  ˠ <    >JOEFY  ˠ ͱ͍͏۩߹Ͱ͢ɻ