Ruby 2 and Rails 4

Ruby 2 and Rails 4

「Ruby 2.0 & Rails 4.0先取りセミナー」の講演資料
(2012/11/21, Web CAT Studioさん主催)
http://atnd.org/events/33996

76a777ff80f30bd3b390e275cce625bc?s=128

Akira Matsuda

November 21, 2012
Tweet

Transcript

  1. Ruby 2.0 & Rails 4.0 দా ໌ (@a_matsuda)

  2. whoami GitHub: amatsuda Twitter: @a_matsuda

  3. None
  4. https://forkwell.com/ ϑϦʔϥϯεͷࣾ֎औక໾ (Ṗ) pull requestʹίϝϯτॻ͘ͻͱ

  5. before

  6. ůŢ RubyKaigiʹࢀՃͨ͜͠ͱ͋Δਓʁ Railsษڧձ@౦ژʹࢀՃͨ͜͠ͱ͋Δਓʁ Asakusa.rbʹࢀՃͨ͜͠ͱ͋Δਓʁ

  7. begin

  8. ຊ೔ͷ͓୊ 2ͭͷʮϝδϟʔόʔδϣϯΞοϓʯ

  9. ϝδϟʔόʔδϣϯΞοϓʂ Ruby: 1.9.3 => 2.0.0 Rails: 3.2.9 => 4.0.0

  10. ۭલͷ ϝδϟʔόʔδϣϯΞοϓظʂ Ruby 2.0 Rails 4.0 Rake 10.0 RubyGems 2.0

    RDoc 4.0 RSpec 3.0 Sprockets 3.0 Capybara 2.0 Rubinius 2.0 ...
  11. ϝδϟʔόʔδϣϯΞοϓظ ࣌୅ͷస׵఺ ৺ػҰస ࢀೖͷνϟϯεʂ

  12. Ruby 2.0

  13. Ruby 2.0 (Matzͷ)௕೥ͷ൵ئ 2001೥ͷୈ1ճRubyConfͷΩʔϊʔτͰ Matz͕طʹRuby 2.0ʹݴٴ ʮֆʹඳ͍ͨṷʯʮ೩ྉʯʮχϯδϯʯ ʮPerl 6ʯ

  14. Rubyͷྺ࢙ 1993೥02݄ ஀ੜ (1993/2/24) 1995೥12݄ ެ։ (0.95) 1996೥12݄ 1.0 1997೥08݄

    1.1 1998೥12݄ 1.2 1999೥08݄ 1.4 2000೥09݄ 1.6 2003೥08݄ 1.8 2013೥02݄ 2.0
  15. Rubyͷྺ࢙ 1993೥02݄ ஀ੜ 1995೥12݄ ެ։ (0.95) 1996೥12݄ 1.0 1997೥08݄ 1.1

    1998೥12݄ 1.2 1999೥08݄ 1.4 2000೥09݄ 1.6
  16. Rubyͷྺ࢙ 1993೥02݄ ஀ੜ 1995೥12݄ ެ։ (0.95) 1996೥12݄ 1.0 1997೥08݄ 1.1

    1998೥12݄ 1.2 1999೥08݄ 1.4 2000೥09݄ 1.6 2003೥08݄ 1.8
  17. ͜ͷࠒͷόʔδϣχϯάϧʔϧ ۮ਺൪߸͕҆ఆ൛

  18. Rubyͷྺ࢙ 1993೥02݄ ஀ੜ 1995೥12݄ ެ։ (0.95) 1996೥12݄ 1.0 1997೥08݄ 1.1

    1998೥12݄ 1.2 1999೥08݄ 1.4 2000೥09݄ 1.6 2003೥08݄ 1.8 2007೥12݄ 1.9.0 (։ൃ൛) Matz's Ruby Ko1's Ruby
  19. ͜ͷࠒͷόʔδϣχϯάϧʔϧ 2έλͷ਺ࣈ͸࢖͍ͨ͘ͳ͍ => 1.10.0 ͸͋Γಘͳ͍ 2.0ͬͯ਺ࣈ͸·ͩ࢖͍ͨ͘ͳ͍ 1.9.0͸։ൃ൛ɺ1.9.1͕҆ఆ൛ͰͲ͏͔

  20. Rubyͷྺ࢙ 1993೥02݄ ஀ੜ 1995೥12݄ ެ։ (0.95) 1996೥12݄ 1.0 1997೥08݄ 1.1

    1998೥12݄ 1.2 1999೥08݄ 1.4 2000೥09݄ 1.6 2003೥08݄ 1.8 2007೥12݄ 1.9.0 (։ൃ൛) 2010೥08݄ 1.9.2 (΄Μͱ͏ͷ҆ఆ൛)
  21. Rubyͷྺ࢙ 1993೥02݄ ஀ੜ 1995೥12݄ ެ։ (0.95) 1996೥12݄ 1.0 1997೥08݄ 1.1

    1998೥12݄ 1.2 1999೥08݄ 1.4 2000೥09݄ 1.6 2003೥08݄ 1.8 2007೥12݄ 1.9.0 (։ൃ൛) 2010೥08݄ 1.9.2 (҆ఆ൛) 2011೥10݄ 1.9.3 (҆ఆ൛)
  22. Rubyͷόʔδϣϯ൪߸ͷมભ 1 1.2 1.4 1.6 1.8 2 1995/12 1996/12 1997/08

    1998/12 1999/08 2000/09 2003/08 2007/12 2010/08 2011/10
  23. Rubyͷྺ࢙ 1993೥02݄ ஀ੜ 1995೥12݄ ެ։ (0.95) 1996೥12݄ 1.0 1997೥08݄ 1.1

    1998೥12݄ 1.2 1999೥08݄ 1.4 2000೥09݄ 1.6 2003೥08݄ 1.8 2007೥12݄ 1.9.0 (։ൃ൛) 2010೥08݄ 1.9.2 (҆ఆ൛) 2011೥10݄ 1.9.3 (҆ఆ൛) 2013೥02݄ 2.0
  24. 2003೥ͷ·ͭ΋ͱ͞ΜͷεϥΠυ http://www.rubyist.net/~matz/slides/rc2003/mgp00009.html

  25. 2003೥ͷ·ͭ΋ͱ͞ΜͷεϥΠυ http://www.rubyist.net/~matz/slides/rc2003/mgp00009.html ࠓճͷ2.0Ͱ࣮૷

  26. Rubyͷྺ࢙ 1993೥02݄ ஀ੜ 1995೥12݄ ެ։ (0.95) 1996೥12݄ 1.0 1997೥08݄ 1.1

    1998೥12݄ 1.2 1999೥08݄ 1.4 2000೥09݄ 1.6 2003೥08݄ 1.8 2007೥12݄ 1.9.0 (։ൃ൛) 2010೥08݄ 1.9.2 (҆ఆ൛) 2013೥02݄ 2.0
  27. 2.0ͷϦϦʔε 2013೥2݄24೔ ʮ஀ੜʯ͔Βͪΐ͏Ͳ20प೥ લ೔ͱ͔ʹ 2.0ϦϦʔεه೦ & ஀ੜ20प೥Πϕϯτ Έ͍ͨͳͷ͕͋ΔΜ͡Όͳ͍͔ͳ͊

  28. 1.9.3..2.0.0 1.8..1.9΄Ͳͷbig jumpͰ͸ͳ͍ ຊ౰ʹॏ͍ͨมߋ(= Ѩඓڣש)͸ 1.9Ͱࡁ·ͤͨ YARVɹ Encodingɹ 1.9͸2.0 preͩͬͨɺͱ΋ݴ͑Δ͔΋

  29. 2.0ͷಛ௃ ࠷ॳ͔Β҆ఆ൛Λࢤ޲ 2.0.0͕ग़ͨॠ͔ؒΒ ҆৺͓ͯ͠࢖͍͍͚ͨͩ·͢ 1.9.3ͱͷޓ׵ੑΛॏࢹ 1.9.3͔ΒεϜʔζʹҠߦͰ͖·͢ ඇޓ׵ͳมߋ͸2.1Ҏ߱ʹ

  30. 1.9.3..2.0.0 ৽ػೳ ύϑΥʔϚϯεͷ޲্ VM GC require σϑΥϧτεΫϦϓτΤϯίʔσΟϯά ͍ͭʹσϑΥϧτUTF-8ʹʂ ΋͔ͨ͠͠Β࠷େͷඇޓ׵ (ʁ)

  31. ύϑΥʔϚϯεͷ޲্ VM GC require

  32. VM: @ko1

  33. None
  34. GC: @nari3

  35. None
  36. ύϑΥʔϚϯεͷ޲্ (DEMO) Railsͷىಈ࣌ؒ RubyͷόʔδϣϯΛ্͛Δ͚ͩͰഒ଎ʹʂ

  37. σϑΥϧτεΫϦϓτΤϯίʔσΟϯά ͍ͭʹσϑΥϧτUTF-8ʹʂ (Ϛδίϝͱ͸Կͩͬͨͷ͔…) ΋͔ͨ͠͠Β࠷େͷඇޓ׵ (ʁ)

  38. Ϛδίϝͱ͸Կͩͬͨͷ͔ ๻ΒϢʔβʔʹͱͬͯඞཁͳஈ֊ͩͬͨ String͕encodingΛ࣋ͭͱ͍͏֓೦ CSIɹ internal encoding, external encodingɹ US-ASCII, ASCII-8BIT,

    BINARYɹ mojibake == ࢮ
  39. ਆల։ encodingɺͳΜͱͳ͘Θ͔ͬͨͰ͠ΐʁ => σϑΥϧτUTF-8 ੒੉͞Μ͍͢͝

  40. @nalsh

  41. None
  42. M17Nʹ͍ͭͯৄ͘͠ ʰA Reintroduction To Ruby M17Nʱ http://www.slideshare.net/nalsh/a-reintroduction- to-ruby-m17-n ʰ Ruby

    M17N ͷઃܭͱ࣮૷ʱ http://jp.rubyist.net/magazine/?0025- Ruby19_m17n
  43. Ruby 2.0ͷ৽ػೳ Refinements Module#prepend Enumerable#lazy ΩʔϫʔυҾ਺ ͳͲͳͲ

  44. Ruby 2.0ͷ৽ػೳ ͋ͱͰ

  45. Rails 4.0

  46. Railsͷόʔδϣϯ൪߸ͷભҠ 2004೥07݄ ެ։ 2005೥12݄ 1.0 2007೥12݄ 2.0 2010೥08݄ 3.0 2012-2013

    4.0
  47. ϝδϟʔόʔδϣϯΞοϓʹ൐͏ ৽ύϥμΠϜ 1.0 DRY, CoC 2.0 RESTful 3.0 Modularity

  48. ϝδϟʔόʔδϣϯΞοϓʹ൐͏ ৽ύϥμΠϜ 1.0 DRY, CoC 2.0 RESTful 3.0 Modularity 4.0

    ಛʹͳ͠ʂ
  49. Rails 4 ʮ৽ػೳʯ͸͍Ζ͍Ζ ʮ৽ύϥμΠϜʯ͸ಛʹͳ͍ جຊతʹ͸3.2ͷਖ਼ৗਐԽܥ 4.0ʹ͖͔͚ͨͬ͠͸ɺRuby 1.8αϙʔτͷ ऴྃ(ʁ)

  50. Railsͷόʔδϣϯ൪߸ઓུ όʔδϣϯ൪߸ͳΜͯ০Γ Rails͸ઈ͑ؒͳ͘มԽ͢Δ1ຊͷઢ࿏Ͱɺ όʔδϣϯͷ۠੾Γ͸్தӺͷΑ͏ͳ΋ͷ

  51. Railsͷʮ৽ʯόʔδϣϯ൪߸ઓུ ৽͍͠όʔδϣϯͰ࢖͑ͳ͘ͳΔػೳ͸ ͍͖ͳΓফ͞ͳ͍ 1ݸલͷόʔδϣϯͰ deprecation warningΛ ग़͢ ࣍ͷόʔδϣϯͰফ͢

  52. 4.0ͷಛ௃ ࠷ॳ͔Β҆ఆ൛Λࢤ޲ 4.0.0͕ग़ͨॠ͔ؒΒ ҆৺͓ͯ͠࢖͍͍͚ͨͩ·͢ 3.2.xͱͷޓ׵ੑΛॏࢹ 3.2.x͔ΒεϜʔζʹҠߦͰ͖·͢

  53. Railsͷόʔδϣϯ൪߸ઓུ όʔδϣϯ൪߸ͳΜͯ০Γ Rails͸ઈ͑ؒͳ͘มԽ͢Δ1ຊͷઢ࿏Ͱɺ όʔδϣϯͷ۠੾Γ͸్தӺͷΑ͏ͳ΋ͷ ͳͷͰɺ4.0ͷ৽ػೳ͕Ͳ͏͜͏ݴ͏ΑΓ΋ ·ͣɺେ͖ͳྲྀΕΛ೺Ѳ͢Δͱྑ͍͔΋

  54. ࠷ۙͷைྲྀ Modern Speed Security Real-time web ActiveRecord Social coding

  55. Modern Ruby '>= 1.9.3'ɹ APIͷ͞ΒͳΔચ࿅ ݹ͍ػೳɺ͋Μ·Γ࢖ΘΕͯͳ͍ػೳΛ ΋Γ΋Γ֎෦Gem΁

  56. ৽API AR͍Ζ͍Ζ AR.where! AR.all (= .scoped) scope :foo, -> {}

    NullRelation AR::Model, AMo::Model update_columns AR.where.not PATCH verb routing concern Russian doll caching
  57. RIP Ruby 1.8 support vendor/plugins ActiveResource AR.find :all dynamic finders

    ActiveRecord::SessionStore Rack::Cache
  58. Speed ύϑΥʔϚϯε޲্ Ruby 1.9Ҡߦʹ൐͏ίʔυͷεϦϜԽ Sprocketsͷprecompile threadsafe! AS::Queue TurboLinks

  59. Security ʮMass Assignment Securityʯ =>ʮStrong Parametersʯ

  60. Real-time web AC::Live (@tenderlove)

  61. @tenderlove

  62. AC::Live "Real Time Salami" https://speakerdeck.com/ tenderlove/real-time-salami

  63. ActiveRecord @tenderlove @jonleighton PostgreSQL

  64. @jonleighton

  65. Social coding 2721 peopleʂ http://contributors.rubyonrails.org/ɹ ೆถ @josevalim @spastorino ൴Βʹଓ͘ୈ3ੈ୅

  66. @josevalim

  67. @spastorino

  68. ͓͠Βͤ @josevailm is speaking at RubyKaigi 2013ʂ

  69. Ruby 2.0ͷ࿩͸ʁ

  70. RubyConfͰ͠Ό΂ͬͨ΍ͭ Ruby 2.0 on Rails http://speakerdeck.com/u/a_matsuda/p/ruby-2- dot-0-on-rails Ruby 2.0 on

    Rails (video) http://www.confreaks.com/videos/1275- rubyconf2012-ruby-2-0-on-rails
  71. ensure The new Ruby world is coming!ɹ People are making

    the Ruby world better everyday! Meet the people (= the community) and say "Hi!" to them! <3 <3 <3
  72. ensure Welcome to the new Ruby world!ɹ Meet the people

    at: Asakusa.rbɹ Railsษڧձ େߐށRubyձٞ03 RubyKaigi 2013
  73. end