Ruby 2.0  What’s	  new?
r                          ions@ gee_for            Interne                             t Solut              About me     ...
History             Install            Deep          Changes  Big                LittleChanges             Changes        ...
History
Ruby’s History                                  0.95                                                                      ...
Ruby’s History                       Rails	  arrives	  on	  the	                         scene.	  Arguably	  the	         ...
Install
The one tru                                 e way                             t rue way                     The oneRVM    ...
Deep Changes
X         X   XBItmap Garbage   Collection     X   X   X
1.9 GC                                                 Heap based M&S                                                 Ruby...
2.0 GC                                              Bitmap marking                                              All	  mark...
X         X   X   BackwardCompatible With      1.9     X   X   X
X         X   Xrequire() speed improvements     X   X   X
Big Changes
X      X   X KeywordArguments  X   X   X
Big Changes KeywordArguments     def foo(foo: ‘bar’, baz: ‘qux’, **rest)       # Do something     end     foo(baz: ‘noqux’...
X     X   XModulePrepend X   X   X
Big ChangesModulePrepend    module IncludableModule      def something; end    end    class MyClass      prepend Includabl...
X       X   X    LazyEnumerators   X   X   X
Big Changes   LazyEnumerators               to_infinity = (0..Float::Infinity)beyond = to_infinity.lazy.select do |n|  num...
X      X   XTracepoint  X   X   X
Big Changes         Trace         PointOO	  alterna*ve	  to	  set_trace_functrace = TracePoint.new(:raise) do |t|  puts "A...
X       X   XRefinements   X   X   X
Big ChangesRefinements     *Localised	  and	  contained	  monkey	  patchingModule MyString  refine String do    def palind...
little Changes
Little Changes  LiteralSymbol listssym_list = %i{eeny meeny miny moe}# => [:eeny, :meeny, :miny, :moe]
Little Changes      Binary      Searchhaystack = (1..99999999)haystack.bsearch do |needle|    needle == 12345end# => 12345
Little Changes    UTF-8On by Default#!/usr/bin/env ruby1.9#encoding: utf-8puts “✖ ✹ ✚ ✭”#!/usr/bin/env ruby-2.0puts “✖ ✹ ✚...
Little Changes           __Dir__          keywordSimilar	  in	  func*onality	  to	  __FILE__Shows	  absolute	  path	  to	 ...
Little Changes                   .to_hFollows	  conven*on	  started	  by	  .to_s,	  to_i,	  to_a,	  etcSuper	  useful	  fo...
Little Changes                   Grab                   BagCGI	  is	  now	  HTML5	  compa*blenet/hLp	  supports	  Server	 ...
Ecosystem
Ecosystem         RubyGems            2.0Start	  of	  support	  for	  stdlib	  gemsNo	  more	  out	  of	  place	  requires...
Ecosystem        Bundler         1.3(.1)Supports	  Ruby	  2.0Supports	  Rubygems	  2.0Supports	  Rails	  4.0install and up...
EcoSystem               Rails             4.0 betaRuby	  2.0	  is	  the	  official	  preferred	  ruby	  versionBeta	  releas...
Now what
Thanks   AnyQuestions?             @gee_forr             GEE.FORR@GMAIL.COM
What's new in Ruby 2.0
Upcoming SlideShare
Loading in...5
×

What's new in Ruby 2.0

859

Published on

In this presentation, I walk the audience through a bunch of changes in Ruby 2.0.

Published in: Technology
1 Comment
4 Likes
Statistics
Notes
  • That's an interesting and beautiful presentation. Can you share the background (especially the light/yellowish one)? Thanks
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
859
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
1
Likes
4
Embeds 0
No embeds

No notes for slide

What's new in Ruby 2.0

  1. 1. Ruby 2.0 What’s  new?
  2. 2. r ions@ gee_for Interne t Solut About me by I <3 Ru #rub yOnBeer
  3. 3. History Install Deep Changes Big LittleChanges Changes Eco System
  4. 4. History
  5. 5. Ruby’s History 0.95 Rails  arrives  on  the   scene.  Arguably  the   First  public  release start  of  Ruby’s  rise. Feb 24 Dec 25 Aug 1993 1996 1.2 1999 1.6 Aug 2003 Dec 2007 Dec 21 Dec Sep Dec 13 1995 1998 1.4 2000 2005I  want  a  language  more  powerful  than  Perl  and   Start  of  Xmas  Tradi.on Language  starts  gaining   Language  hits  the  big  more  OO  than  Python serious  trac.on .me. 1.0 1.8 1.9
  6. 6. Ruby’s History Rails  arrives  on  the   scene.  Arguably  the   start  of  Ruby’s  rise. Aug Dec 2003 2007 Dec 13 2.0 2005nguage  starts  gaining   Feb 24 Start  of  Xmas  Tradi.on the  big   Language  hits  rious  trac.on .me. 2013 1.8 1.9
  7. 7. Install
  8. 8. The one tru e way t rue way The oneRVM RBENV✦Update  RVM ✦Update  rbenv✦rvm install ruby-2.0.0 ✦rbenv install 2.0.0-p0
  9. 9. Deep Changes
  10. 10. X X XBItmap Garbage Collection X X X
  11. 11. 1.9 GC Heap based M&S Ruby  structures  are  divided  in  2     halves,  data  and  flags.  Each   structure  has  its  own  flag.  Mark   phase  trawls  through  heap  and   updates  FL_MARK  flag  in  every   object RString diagram from: http://patshaughnessy.net/2012/3/23/why-you-should-be-excited-about-garbage-collection-in-ruby-2-0
  12. 12. 2.0 GC Bitmap marking All  mark  flags  for  heap  move  to   single  dedicated  data  structure.   1  for  In  Use,  0  for  Collectable. Flag  not  wriMen  to  data   structure,  much  more  friendly   to  copy-­‐on-­‐write Heap diagram from: http://patshaughnessy.net/2012/3/23/why-you-should-be-excited-about-garbage-collection-in-ruby-2-0
  13. 13. X X X BackwardCompatible With 1.9 X X X
  14. 14. X X Xrequire() speed improvements X X X
  15. 15. Big Changes
  16. 16. X X X KeywordArguments X X X
  17. 17. Big Changes KeywordArguments def foo(foo: ‘bar’, baz: ‘qux’, **rest) # Do something end foo(baz: ‘noqux’, foo: ‘frob’)
  18. 18. X X XModulePrepend X X X
  19. 19. Big ChangesModulePrepend module IncludableModule def something; end end class MyClass prepend IncludableModule end
  20. 20. X X X LazyEnumerators X X X
  21. 21. Big Changes LazyEnumerators to_infinity = (0..Float::Infinity)beyond = to_infinity.lazy.select do |n| num % 42 == 0end100.times do { |n| puts beyond.next }
  22. 22. X X XTracepoint X X X
  23. 23. Big Changes Trace PointOO  alterna*ve  to  set_trace_functrace = TracePoint.new(:raise) do |t| puts "Alert: Exception raised!"endtrace.enable
  24. 24. X X XRefinements X X X
  25. 25. Big ChangesRefinements *Localised  and  contained  monkey  patchingModule MyString refine String do def palindrome? self == self.reverse end endendusing MyString # Monkey patch now active for context
  26. 26. little Changes
  27. 27. Little Changes LiteralSymbol listssym_list = %i{eeny meeny miny moe}# => [:eeny, :meeny, :miny, :moe]
  28. 28. Little Changes Binary Searchhaystack = (1..99999999)haystack.bsearch do |needle| needle == 12345end# => 12345
  29. 29. Little Changes UTF-8On by Default#!/usr/bin/env ruby1.9#encoding: utf-8puts “✖ ✹ ✚ ✭”#!/usr/bin/env ruby-2.0puts “✖ ✹ ✚ ✭”
  30. 30. Little Changes __Dir__ keywordSimilar  in  func*onality  to  __FILE__Shows  absolute  path  to  file’s  directoryNo  more  clunky  File.dirname(__FILE__)
  31. 31. Little Changes .to_hFollows  conven*on  started  by  .to_s,  to_i,  to_a,  etcSuper  useful  for  conver*ng  Structs
  32. 32. Little Changes Grab BagCGI  is  now  HTML5  compa*blenet/hLp  supports  Server  Name  Indica*on  (SNI)Zlib  runs  outside  of  the  Global  Interpreter  LockUnused  variables  can  be  prepended  with  _  to  avoid  warnings
  33. 33. Ecosystem
  34. 34. Ecosystem RubyGems 2.0Start  of  support  for  stdlib  gemsNo  more  out  of  place  requires!  MOAR  BUNDLAR!Searching  is  remote  by  defaultMetadata  through  Gem::Specifica*on#metadataSimplified  --document/--no-documentNo  more  --no-rdoc --no-ri mantra
  35. 35. Ecosystem Bundler 1.3(.1)Supports  Ruby  2.0Supports  Rubygems  2.0Supports  Rails  4.0install and update up  to  150x  fasterSupport  for  signed  gems!
  36. 36. EcoSystem Rails 4.0 betaRuby  2.0  is  the  official  preferred  ruby  versionBeta  released  1  day  a_er  Ruby  2.0gem install rails --version 4.0.0.beta1 --no-documentgem ‘rails’, ‘4.0.0-beta1’
  37. 37. Now what
  38. 38. Thanks AnyQuestions? @gee_forr GEE.FORR@GMAIL.COM

×