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

+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@
 
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
 

Recently uploaded (20)

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
+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...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

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