SlideShare a Scribd company logo
1 of 45
Ruby1.9.1
Ruby1.9.1
 Brad Feeley
Ruby1.9.1
 Brad Feeley
 I work at Digitaria
Ruby1.9.1




        What is it?
Ruby1.9.1




           What is it?

  “ Ruby 1.9 is a new series of Ruby. It is modern,
  faster, with clearer syntax, multilingualized,
          a much improved version of Ruby.
Ruby1.9.1




            Faster   JRuby
Ruby1.9.1




               Faster
            New virtual machine YARV
Ruby1.9.1




               Faster                  Maybe another
                                       presentation?



            New virtual machine YARV
             Kernal (native) threads
Ruby1.9.1




   Multilingualized
            a.k.a. m17n
Ruby1.9.1




   Multilingualized
            File Level Encoding
Ruby1.9.1




   Multilingualized
            File Level Encoding

        # encodeing: utf-8
        alias π = Math::PI
Ruby1.9.1




   Multilingualized
            String Level Encoding
Ruby1.9.1




   Multilingualized
            String Level Encoding

   my_string.encode(“iso-8859-1”)
Ruby1.9.1




   Multilingualized
            IO Level Encoding
Ruby1.9.1




   Multilingualized
            IO Level Encoding

   f.open(‘file.txt’, ‘r:ascii’)
   data = f.read
   data.encoding.name
    # => ‘US-ASCII’
Ruby1.9.1




    Cleaner Syntax
Cleaner Syntax
Ruby1.9.1



              String
            No longer Enumerable
Cleaner Syntax
Ruby1.9.1



                 String
              No longer Enumerable

1.8   String.ancestors
      => [String, Enumerable, Comparable, Object, Kernel]



1.9   String.ancestors
      => [String, Comparable, Object, Kernel]
Cleaner Syntax
Ruby1.9.1



                 String
              No longer Enumerable

1.8   my_string_var.each { |line| puts line }




1.9   my_string_var.each_line { |line| puts line }
Cleaner Syntax
Ruby1.9.1



                     String
 str = “test”
 str.clear # => “”

 “hellonworld”.lines # => [“hellon”, “world”]

 “hello”.encoding # => “UTF-8”

 “kitty”.start_with? “cat” # => false
 “kitty”.end_with? “tty”   # => true
Cleaner Syntax
Ruby1.9.1



            Array
Cleaner Syntax
Ruby1.9.1



                         Array
 vowels = ['a','e','i', ‘o’, ‘u’]
 vowels.index{|letter| letter == 'e'} # => 1

 a = [1,2,3]
 a.permutation(2).to_a   #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
 a.combination(2).to_a   #=> [[1, 2], [1, 3], [2, 3]]

 a.to_s # => “[1, 2, 3]”

 a.pop(2) #=> [2, 3]
Cleaner Syntax
Ruby1.9.1



            Hash
Cleaner Syntax
Ruby1.9.1



               Hash
            New Key Value Syntax
Cleaner Syntax
Ruby1.9.1



                  Hash
              New Key Value Syntax

1.8   render :action => ‘new’
Cleaner Syntax
Ruby1.9.1



                  Hash
              New Key Value Syntax

1.8   render :action => ‘new’




1.9   render action: ‘new’
Cleaner Syntax
Ruby1.9.1



                  Hash
               Order Preservation
   h = {:a => 1, :b => 2, :c => 3 }
   h[:d] = 4

1.8   puts h.inspect => {:4 => d, :a => 1, :b => 2, :c => 3 }
Cleaner Syntax
Ruby1.9.1



                  Hash
               Order Preservation
   h = {:a => 1, :b => 2, :c => 3 }
   h[:d] = 4

1.8   puts h.inspect => {:4 => d, :a => 1, :b => 2, :c => 3 }




1.9   puts h.inspect => {:a => 1, :b => 2, :c => 3, :4 => d }
Cleaner Syntax
Ruby1.9.1



            Proc
Cleaner Syntax
Ruby1.9.1



                 Proc
            New Declaration Syntax


 1.8   say_hi = lambda { |a| “Hello, #{a}” }
Cleaner Syntax
Ruby1.9.1



                 Proc
            New Declaration Syntax


 1.8   say_hi = lambda { |a| “Hello, #{a}” }



 1.9   say_hi = ->(a){ “Hello, #{a}” }
Cleaner Syntax
Ruby1.9.1



                 Proc
            New Declaration Syntax


 1.8   a = lambda { |x, y=1| x * y } #=> ERROR
Cleaner Syntax
Ruby1.9.1



                 Proc
            New Declaration Syntax


 1.8   a = lambda { |x, y=1| x * y } #=> ERROR



 1.9   a = ->(x, y=1){ x * y }
       a = ->(&x){ x.call }
Cleaner Syntax
Ruby1.9.1



                 Proc
             New Calling Syntax
 say_hi = lambda { |a| “Hello, #{a}” }


1.8   say_hi.call(‘Quentin’) # => Hello, Quentin
Cleaner Syntax
Ruby1.9.1



                 Proc
             New Calling Syntax
 say_hi = lambda { |a| “Hello, #{a}” }


1.8   say_hi.call(‘Quentin’) # => Hello, Quentin


1.9   say_hi.(‘Quentin’) # => Hello, Quentin
Cleaner Syntax
Ruby1.9.1



       Block Scope
            n = “Hello, World!”
            [1,2,3].each do |n|
              #do something
            end
Cleaner Syntax
Ruby1.9.1



       Block Scope
            n = “Hello, World!”
            [1,2,3].each do |n|
              #do something
            end


1.8   puts n # => 3
Cleaner Syntax
Ruby1.9.1



       Block Scope
            n = “Hello, World!”
            [1,2,3].each do |n|
              #do something
            end


1.8   puts n # => 3


1.9   puts n # => “Hello, World!”
Cleaner Syntax
Ruby1.9.1



       Debugging
Cleaner Syntax
Ruby1.9.1



         Debugging
   -w whitespace
Cleaner Syntax
Ruby1.9.1



         Debugging
   -w whitespace

   Method#owner
     #=> module the method belongs to

   Method#source_location
     #=> where the method is defined
Ruby1.9.1



             Installation
 http://gist.github.com/59130
 wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.bz2
 tar -xjvf ruby-1.9.1-p0.tar.bz2
 cd ruby-1.9.1-p0
 ./configure --prefix=/usr --program-suffix=19 --enable-shared
 make && make install
Ruby1.9.1



     Ruby on Rails
Ruby1.9.1



        Resources
            •http://www.google.com
Ruby1.9.1



       Questions?

More Related Content

What's hot

Caching
CachingCaching
Caching
jo7714
 

What's hot (19)

Optimizing Erlang Code for Speed
Optimizing Erlang Code for SpeedOptimizing Erlang Code for Speed
Optimizing Erlang Code for Speed
 
Perl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one linersPerl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one liners
 
Source Plugins
Source PluginsSource Plugins
Source Plugins
 
Intro to MQ
Intro to MQIntro to MQ
Intro to MQ
 
Write a redis client of your own
Write a redis client of your ownWrite a redis client of your own
Write a redis client of your own
 
Introduction To Distributed Erlang
Introduction To Distributed ErlangIntroduction To Distributed Erlang
Introduction To Distributed Erlang
 
Debug Line Issues After Relaxation.
Debug Line Issues After Relaxation.Debug Line Issues After Relaxation.
Debug Line Issues After Relaxation.
 
Parboiled explained
Parboiled explainedParboiled explained
Parboiled explained
 
email delivery
email deliveryemail delivery
email delivery
 
Algorithm 4
Algorithm  4Algorithm  4
Algorithm 4
 
TDC2016POA | Trilha Programacao Funcional - Ramda JS como alternativa a under...
TDC2016POA | Trilha Programacao Funcional - Ramda JS como alternativa a under...TDC2016POA | Trilha Programacao Funcional - Ramda JS como alternativa a under...
TDC2016POA | Trilha Programacao Funcional - Ramda JS como alternativa a under...
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
 
Caching
CachingCaching
Caching
 
Polling server
Polling serverPolling server
Polling server
 
Subversion To Mercurial
Subversion To MercurialSubversion To Mercurial
Subversion To Mercurial
 
Performance testing of microservices in Action
Performance testing of microservices in ActionPerformance testing of microservices in Action
Performance testing of microservices in Action
 
DNS 101: Introducción a DNS en Español
DNS 101: Introducción a DNS en EspañolDNS 101: Introducción a DNS en Español
DNS 101: Introducción a DNS en Español
 
gRPC in Go
gRPC in GogRPC in Go
gRPC in Go
 
Return Oriented Programming (ROP chaining)
Return Oriented Programming (ROP chaining)Return Oriented Programming (ROP chaining)
Return Oriented Programming (ROP chaining)
 

Viewers also liked (7)

ObjectId in Mongodb
ObjectId in MongodbObjectId in Mongodb
ObjectId in Mongodb
 
Enhance you APDEX.. naturally!
Enhance you APDEX.. naturally!Enhance you APDEX.. naturally!
Enhance you APDEX.. naturally!
 
Exceptions in Ruby - Tips and Tricks
Exceptions in Ruby - Tips and TricksExceptions in Ruby - Tips and Tricks
Exceptions in Ruby - Tips and Tricks
 
Rails performance: Ruby GC tweaking
Rails performance: Ruby GC tweaking Rails performance: Ruby GC tweaking
Rails performance: Ruby GC tweaking
 
Encodings - Ruby 1.8 and Ruby 1.9
Encodings - Ruby 1.8 and Ruby 1.9Encodings - Ruby 1.8 and Ruby 1.9
Encodings - Ruby 1.8 and Ruby 1.9
 
Problemas 1 al 7, diagrama de flujo problema 7, y pseudocódigo y diagrama de ...
Problemas 1 al 7, diagrama de flujo problema 7, y pseudocódigo y diagrama de ...Problemas 1 al 7, diagrama de flujo problema 7, y pseudocódigo y diagrama de ...
Problemas 1 al 7, diagrama de flujo problema 7, y pseudocódigo y diagrama de ...
 
4 cylinder diesel engine (1.9 l engine) VW
4 cylinder diesel engine (1.9 l engine) VW4 cylinder diesel engine (1.9 l engine) VW
4 cylinder diesel engine (1.9 l engine) VW
 

Similar to Ruby 1.9 Introduction

Migrating To Ruby1.9
Migrating To Ruby1.9Migrating To Ruby1.9
Migrating To Ruby1.9
tomaspavelka
 
Ruby19 osdc-090418222718-phpapp02
Ruby19 osdc-090418222718-phpapp02Ruby19 osdc-090418222718-phpapp02
Ruby19 osdc-090418222718-phpapp02
Apoorvi Kapoor
 

Similar to Ruby 1.9 Introduction (20)

Migrating To Ruby1.9
Migrating To Ruby1.9Migrating To Ruby1.9
Migrating To Ruby1.9
 
Ruby19 osdc-090418222718-phpapp02
Ruby19 osdc-090418222718-phpapp02Ruby19 osdc-090418222718-phpapp02
Ruby19 osdc-090418222718-phpapp02
 
An introduction to Ruby
An introduction to RubyAn introduction to Ruby
An introduction to Ruby
 
Ruby 1.9
Ruby 1.9Ruby 1.9
Ruby 1.9
 
The Ring programming language version 1.9 book - Part 17 of 210
The Ring programming language version 1.9 book - Part 17 of 210The Ring programming language version 1.9 book - Part 17 of 210
The Ring programming language version 1.9 book - Part 17 of 210
 
Use PEG to Write a Programming Language Parser
Use PEG to Write a Programming Language ParserUse PEG to Write a Programming Language Parser
Use PEG to Write a Programming Language Parser
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Dutch PHP Conference 2013: Distilled
Dutch PHP Conference 2013: DistilledDutch PHP Conference 2013: Distilled
Dutch PHP Conference 2013: Distilled
 
Impacta - Show Day de Rails
Impacta - Show Day de RailsImpacta - Show Day de Rails
Impacta - Show Day de Rails
 
What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?
 
A Toda Maquina Con Ruby on Rails
A Toda Maquina Con Ruby on RailsA Toda Maquina Con Ruby on Rails
A Toda Maquina Con Ruby on Rails
 
Advanced Perl Techniques
Advanced Perl TechniquesAdvanced Perl Techniques
Advanced Perl Techniques
 
Get your ass to 1.9
Get your ass to 1.9Get your ass to 1.9
Get your ass to 1.9
 
The Ring programming language version 1.8 book - Part 15 of 202
The Ring programming language version 1.8 book - Part 15 of 202The Ring programming language version 1.8 book - Part 15 of 202
The Ring programming language version 1.8 book - Part 15 of 202
 
The Ring programming language version 1.5.1 book - Part 38 of 180
The Ring programming language version 1.5.1 book - Part 38 of 180The Ring programming language version 1.5.1 book - Part 38 of 180
The Ring programming language version 1.5.1 book - Part 38 of 180
 
Week1
Week1Week1
Week1
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for Ruby
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby Core
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

Ruby 1.9 Introduction

  • 3. Ruby1.9.1 Brad Feeley I work at Digitaria
  • 4. Ruby1.9.1 What is it?
  • 5. Ruby1.9.1 What is it? “ Ruby 1.9 is a new series of Ruby. It is modern, faster, with clearer syntax, multilingualized, a much improved version of Ruby.
  • 6. Ruby1.9.1 Faster JRuby
  • 7. Ruby1.9.1 Faster New virtual machine YARV
  • 8. Ruby1.9.1 Faster Maybe another presentation? New virtual machine YARV Kernal (native) threads
  • 9. Ruby1.9.1 Multilingualized a.k.a. m17n
  • 10. Ruby1.9.1 Multilingualized File Level Encoding
  • 11. Ruby1.9.1 Multilingualized File Level Encoding # encodeing: utf-8 alias π = Math::PI
  • 12. Ruby1.9.1 Multilingualized String Level Encoding
  • 13. Ruby1.9.1 Multilingualized String Level Encoding my_string.encode(“iso-8859-1”)
  • 14. Ruby1.9.1 Multilingualized IO Level Encoding
  • 15. Ruby1.9.1 Multilingualized IO Level Encoding f.open(‘file.txt’, ‘r:ascii’) data = f.read data.encoding.name # => ‘US-ASCII’
  • 16. Ruby1.9.1 Cleaner Syntax
  • 17. Cleaner Syntax Ruby1.9.1 String No longer Enumerable
  • 18. Cleaner Syntax Ruby1.9.1 String No longer Enumerable 1.8 String.ancestors => [String, Enumerable, Comparable, Object, Kernel] 1.9 String.ancestors => [String, Comparable, Object, Kernel]
  • 19. Cleaner Syntax Ruby1.9.1 String No longer Enumerable 1.8 my_string_var.each { |line| puts line } 1.9 my_string_var.each_line { |line| puts line }
  • 20. Cleaner Syntax Ruby1.9.1 String str = “test” str.clear # => “” “hellonworld”.lines # => [“hellon”, “world”] “hello”.encoding # => “UTF-8” “kitty”.start_with? “cat” # => false “kitty”.end_with? “tty” # => true
  • 22. Cleaner Syntax Ruby1.9.1 Array vowels = ['a','e','i', ‘o’, ‘u’] vowels.index{|letter| letter == 'e'} # => 1 a = [1,2,3] a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]] a.combination(2).to_a #=> [[1, 2], [1, 3], [2, 3]] a.to_s # => “[1, 2, 3]” a.pop(2) #=> [2, 3]
  • 24. Cleaner Syntax Ruby1.9.1 Hash New Key Value Syntax
  • 25. Cleaner Syntax Ruby1.9.1 Hash New Key Value Syntax 1.8 render :action => ‘new’
  • 26. Cleaner Syntax Ruby1.9.1 Hash New Key Value Syntax 1.8 render :action => ‘new’ 1.9 render action: ‘new’
  • 27. Cleaner Syntax Ruby1.9.1 Hash Order Preservation h = {:a => 1, :b => 2, :c => 3 } h[:d] = 4 1.8 puts h.inspect => {:4 => d, :a => 1, :b => 2, :c => 3 }
  • 28. Cleaner Syntax Ruby1.9.1 Hash Order Preservation h = {:a => 1, :b => 2, :c => 3 } h[:d] = 4 1.8 puts h.inspect => {:4 => d, :a => 1, :b => 2, :c => 3 } 1.9 puts h.inspect => {:a => 1, :b => 2, :c => 3, :4 => d }
  • 30. Cleaner Syntax Ruby1.9.1 Proc New Declaration Syntax 1.8 say_hi = lambda { |a| “Hello, #{a}” }
  • 31. Cleaner Syntax Ruby1.9.1 Proc New Declaration Syntax 1.8 say_hi = lambda { |a| “Hello, #{a}” } 1.9 say_hi = ->(a){ “Hello, #{a}” }
  • 32. Cleaner Syntax Ruby1.9.1 Proc New Declaration Syntax 1.8 a = lambda { |x, y=1| x * y } #=> ERROR
  • 33. Cleaner Syntax Ruby1.9.1 Proc New Declaration Syntax 1.8 a = lambda { |x, y=1| x * y } #=> ERROR 1.9 a = ->(x, y=1){ x * y } a = ->(&x){ x.call }
  • 34. Cleaner Syntax Ruby1.9.1 Proc New Calling Syntax say_hi = lambda { |a| “Hello, #{a}” } 1.8 say_hi.call(‘Quentin’) # => Hello, Quentin
  • 35. Cleaner Syntax Ruby1.9.1 Proc New Calling Syntax say_hi = lambda { |a| “Hello, #{a}” } 1.8 say_hi.call(‘Quentin’) # => Hello, Quentin 1.9 say_hi.(‘Quentin’) # => Hello, Quentin
  • 36. Cleaner Syntax Ruby1.9.1 Block Scope n = “Hello, World!” [1,2,3].each do |n| #do something end
  • 37. Cleaner Syntax Ruby1.9.1 Block Scope n = “Hello, World!” [1,2,3].each do |n| #do something end 1.8 puts n # => 3
  • 38. Cleaner Syntax Ruby1.9.1 Block Scope n = “Hello, World!” [1,2,3].each do |n| #do something end 1.8 puts n # => 3 1.9 puts n # => “Hello, World!”
  • 40. Cleaner Syntax Ruby1.9.1 Debugging -w whitespace
  • 41. Cleaner Syntax Ruby1.9.1 Debugging -w whitespace Method#owner #=> module the method belongs to Method#source_location #=> where the method is defined
  • 42. Ruby1.9.1 Installation http://gist.github.com/59130 wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.bz2 tar -xjvf ruby-1.9.1-p0.tar.bz2 cd ruby-1.9.1-p0 ./configure --prefix=/usr --program-suffix=19 --enable-shared make && make install
  • 43. Ruby1.9.1 Ruby on Rails
  • 44. Ruby1.9.1 Resources •http://www.google.com
  • 45. Ruby1.9.1 Questions?

Editor's Notes