Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

The Ruby 1.9 Walkthrough: The Ultimate Ruby 1.9 Primer for 1.8 Developers

By Peter Cooper / September 20, 2011

In a presentation about Ruby 1.9.3, Yuki Sonoda notes that Ruby 1.8 has "no future" and its "end of life" is being discussed pretty seriously. Ruby 1.8 is becoming history, but what's the alternative? Why, Ruby 1.9! :-)

Even amongst the groups I'm involved with, I've seen a lot of resistance to Ruby 1.9. Sometimes it's because of deployment or library concerns, but often there's a hesitancy over what's changed, what's new, or what has been flat out removed from 1.9. So I've been working on something to help out.. because I think Ruby 1.9 is awesome and everyone should be taking it seriously ASAP.

Presenting.. the Ruby 1.9 Walkthrough

The Ruby 1.9 Walkthrough is an extended-length screencast that walks you through what's new, gone, or plain different in Ruby 1.9.2 and 1.9.3 vs 1.8. It's everything you wanted to know about 1.9 but were afraid to ask :-) (There's a short sample there too if you want to get a feel for it.)

It's only $24 and you get a 3 hour video organized into logical sections which you can either watch straight through or jump around at your pleasure. In due course, I'll also be wrapping up my notes with more sample code into a PDF version to send to everyone, but that's still a little ways off (though you can enjoy my rather scrappy notes if you like).

Some of What You'll Learn

My notes came to almost 500 lines in all but here's a snapshot of what's covered:

  • How proc and lambda behavior differs significantly from 1.8
  • How to wrestle with character encodings like UTF-8 (and issues to be aware of when upgrading old apps)
  • The new and differing ways to check range membership
  • How old Ruby 1.9 is and where it has descended from
  • New tricks and techniques opened up by the awesome new Oniguruma-based regular expression engine
  • The new MiniTest::Unit and MiniTest::Spec libraries
  • Quickly calling system library functions with Fiddle
  • Code coverage utilities right in the stdlib
  • Extensions to splat (*) behavior in 1.9
  • New hash syntax and key changes to hash methods
  • The 3 different encoding types in 1.9 and why each is important
  • What fibers are, how they compare to threads, and how threads have changed
  • Why Proc#=== makes sense as a way to call procs.. sometimes
  • 1.9.3 specific updates (stuff that's not even in 1.9.2!)
  • How to tweak the garbage collector in 1.9.3
  • .. and I've barely scratched the surface!

The Full Contents

Here are the main sections of the video (along with their starting time):

  • 00h 00m — Introduction from Peter Cooper
  • 00h 04m — Ruby 1.9's history
  • 00h 11m — Alternative 1.9 Implementations
  • 00h 13m — Key Changes (Overview)
  • 00h 19m — Getting Ruby 1.9
  • 00h 21m — Strings
  • 00h 30m — Character Encoding
  • 00h 49m — Hashes
  • 00h 56m — Arrays
  • 01h 02m — Procs and Lambdas
  • 01h 16m — Blocks
  • 01h 20m — Enumerators and Enumerable
  • 01h 24m — Regular Expressions
  • 01h 35m — Threads
  • 01h 38m — Fibers
  • 01h 42m — Time
  • 01h 46m — Standard Library (New and Gone)
  • 02h 05m — New Syntax and Miscellaneous Elements
  • 02h 45m — Garbage Collection
  • 02h 50m — Ruby 1.9.3 Specifics

So check out The Ruby 1.9 Walkthrough. There's a 5 minute sample MPEG 4 file you can download if you want to get a feel for it or check that the video format/codec suits you. (If you have problems though, you can always e-mail me. I have a special Apple TV version available on request too.)

This post also kicks off a short season of Ruby 1.9 related blog posts. I'm going to be going over specific elements of Ruby 1.9 syntax, changes, or additions here on Ruby Inside over the coming weeks. Ruby 1.9 is important and I'd love to see more people using it :-)

Comments

  1. Murray Bozinsky says:

    I like 1.9 a lot, it is moving the language in the right direction.

    A problem is that until REE starts supporting 1.9, making 1.8 pretty much the defacto version which is quite sad.

    When is Ruby going to get versioned docs?

  2. Peter Cooper says:

    Ahh, but the cool thing about 1.9.3 (out soon) is that it has a better garbage collector anyway AND it supports command line GC tweaking.. so you can do REE style tweaks on the fly :-) I'll write more about this soon.

  3. Ochronsu says:

    Nice, thanks!

    Readers might also find my related blog post Ruby 1.9 changes, cherry picked interesting.

  4. Pingback: State of the Stack – A Ruby on Rails Benchmarking Report – Sept. 2011 | New Relic blog

  5. Mykola Kyryk says:

    Peter, great video. One question: can you share your tweaked IRB with output from all the ruby implementations. It would be great to do some experiments by myself :)

Other Posts to Enjoy

Twitter Mentions