SlideShare a Scribd company logo
1 of 91
Download to read offline
O que tem de novo no

Ruby 2?
               Fabio Akita
              @akitaonrails
          codeminer42.com
Ruby 0.95   Dez 1995

Ruby 1.8    Ago 2003

Rails 0.8   Dez 2005

Ruby 1.9    Dez 2007
Ruby 0.95   Dez 1995

Ruby 1.8    Ago 2003

Rails 0.8   Dez 2005

Ruby 1.9    Dez 2007
Ruby 0.95   Dez 1995

Ruby 1.8    Ago 2003

Rails 0.8   Dez 2005

Ruby 1.9    Dez 2007
Ruby 0.95   Dez 1995

Ruby 1.8    Ago 2003

Rails 0.8   Dez 2005

Ruby 1.9    Dez 2007
Ruby 2.0
  24 de Fevereiro de 2013
Compatível com 1.9
Literal Symbol List
> %q[hello world]
=> "hello world"

> %i[hello world]
=> [:hello, :world]
Keyword Arguments
def foo(options = {})
  param1 = options[:param1]
  param2 = options[:param2]
  return [param1, param2]
end

> foo param1: "Hello", param2: "World"
=> ["Hello", "World"]
def foo(param1: nil, param2: nil)
  return [param1, param2]
end

> foo param1: "Hello", param2: "World"
=> ["Hello", "World"]
Module Prepend
> [1,2,3].to_s
=> "[1, 2, 3]"
module Foo
  def self.included(base)
    base.class_eval do
      alias_method :original_to_s, :to_s

      def to_s
        original_to_s + ", Foo"
      end
    end
  end
end

class Array
  include Foo
end
> [1,2,3].to_s
=> "[1, 2, 3], Foo"

> Array.ancestors
=> [Array, Foo, Enumerable, Object, Kernel,
BasicObject]
module Foo
  def to_s
    super + ", Foo"
  end
end

class Array
  prepend Foo
end
> [1,2,3].to_s
=> "[1, 2, 3], Foo"

> Array.ancestors
=> [Foo, Array, Enumerable, Object, Kernel,
BasicObject]
Lazy Enumerators
> a = (0..3).map { |i| i }
=> [0, 1, 2, 3]
> a = (0..3).lazy.map { |i| i }
=> #<Enumerator::Lazy: #<Enumerator::Lazy: 0..3>:map>

> a.next
=> 0
> a.next
=> 1
> a.next
=> 2
> a.next
=> 3
> a = (0..Float::INFINITY).lazy.map { |i| i }
=> #<Enumerator::Lazy: #<Enumerator::Lazy:
0..Infinity>:map>

> a.next
=> 0
> a.next
=> 1
> a.next
=> 2
> a.next
=> 3
Refinements
module Foo
  def hello
    "Hello, #{to_s}"
  end
end

class Array
  include Foo
end

> [1,2,3].hello
=> "Hello, [1, 2, 3]"
module Foo
  refine Array do
    def hello
      "Hello, #{to_s}"
    end
  end
end

using Foo

> [1,2,3].hello
=> "Hello, [1, 2, 3]"
module Foo               def bah
  refine Array do          [1,2,3].hello
    def hello            end
      "Hello, #{to_s}"
    end                  > bah.hello
  end                    NoMethodError: undefined
end                      method `hello' for
                         "Hello, [1, 2,
using Foo                3]":String

> [1,2,3].hello
=> "Hello, [1, 2, 3]"
http://rvm.io
curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled
http://gembundler.com/
Browser




NGINX


Worker




 Linux
Browser




NGINX


Worker




 Linux
Browser




NGINX


Worker




 Ruby


 Linux
Browser




NGINX


Worker


 Rails

 Ruby


 Linux
Browser




NGINX


Worker


 Rails

 Ruby


 Linux
Browser   Browser           Browser   Browser




                    NGINX


Worker    Worker            Worker    Worker


 Rails     Rails             Rails      Rails

Ruby       Ruby              Ruby      Ruby


                    Linux
Browser   Browser           Browser   Browser




                    NGINX


Worker    Worker            Worker    Worker


 Rails     Rails             Rails      Rails

Ruby       Ruby              Ruby      Ruby


                    Linux
M&S
Mark & Sweep GC
struct RBasic {
    VALUE flags;   RString
                    flags

    VALUE klass;    klass

};
RString   RString   RString
 flags     flags     flags

 klass     klass     klass
RString   RString   RString
 flags     flags     flags

 klass     klass     klass




          fork()
RString   RString   RString
 flags     flags     flags

 klass     klass     klass




          fork()
RString    RString     RString
 flags       flags      flags

 klass       klass      klass




          GC.start()



RString    RString     RString
 flags       flags      flags

 klass       klass      klass
OOBW
 Out of Band Work
Lazy
Lazy Sweep GC - Ruby 1.9.3
“CoW”
 Copy on Write
RString   RString   RString
 flags     flags     flags

 klass     klass     klass
RString   RString   RString
 flags     flags     flags

 klass     klass     klass
RString   RString   RString
 flags     flags     flags

 klass     klass     klass
RString   RString   RString
 flags     flags     flags

 klass     klass     klass
fork()
GC.start
Bitmap
Bitmap Marking GC - Ruby 2.0
9   00001001


8   00001000


7   00000111
9   00001001


8   00001000


7   00000111
9   00001001


8   00001000


7   00000111
00000001   2^0   1     User


00000010   2^1   2   Moderator


00000100   2^2   4 Administrator
00000001   2^0   1     User


00000010   2^1   2   Moderator


00000100   2^2   4 Administrator
00000001   2^0   1     User


00000010   2^1   2   Moderator


00000100   2^2   4 Administrator
1   1   1   0   0   0   0   0   0   0   0
1   1   1   0   0   0   0   0   0   0   0




                                            fork()
fork()
fork()
Browser   Browser           Browser   Browser




                    NGINX


Worker    Worker            Worker    Worker


 Rails     Rails             Rails      Rails

Ruby       Ruby              Ruby      Ruby


                    Linux
Browser
     Browser
          Browser
               Browser
                    Browser
                         Browser
                              Browser
                                   Browser
                                        Browser
                                             Browser




                             NGINX


  Worker Worker
      Worker Worker
                 Worker
                     Worker
                         Worker
                             Worker
                                 Worker
                                     Worker


   Rails Rails Rails Rails Rails Rails Rails Rails Rails Rails

   RubyRuby Ruby Ruby Ruby Ruby Ruby Ruby Ruby Ruby


                             Linux
Browser
     Browser
          Browser
               Browser
                    Browser
                         Browser
                              Browser
                                   Browser
                                        Browser
                                             Browser




                             NGINX


  Worker Worker
      Worker Worker
                 Worker
                     Worker
                         Worker
                             Worker
                                 Worker
                                     Worker


   Rails Rails Rails Rails Rails Rails Rails Rails Rails Rails

   RubyRuby Ruby Ruby Ruby Ruby Ruby Ruby Ruby Ruby


                             Linux
Rails 3.2.12+


  Rails 4.0
Thanks!
 @akitaonrails

More Related Content

What's hot

20140419 oedo rubykaigi04
20140419 oedo rubykaigi0420140419 oedo rubykaigi04
20140419 oedo rubykaigi04Hiroshi SHIBATA
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Hiroshi SHIBATA
 
Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3Hiroshi SHIBATA
 
20140425 ruby conftaiwan2014
20140425 ruby conftaiwan201420140425 ruby conftaiwan2014
20140425 ruby conftaiwan2014Hiroshi SHIBATA
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesHiroshi SHIBATA
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Hiroshi SHIBATA
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and futureHiroshi SHIBATA
 
The Future of library dependency management of Ruby
 The Future of library dependency management of Ruby The Future of library dependency management of Ruby
The Future of library dependency management of RubyHiroshi SHIBATA
 
tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02Hiroshi SHIBATA
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mrubyHiroshi SHIBATA
 
OSS Security the hard way
OSS Security the hard wayOSS Security the hard way
OSS Security the hard wayHiroshi SHIBATA
 
The Future of Dependency Management for Ruby
The Future of Dependency Management for RubyThe Future of Dependency Management for Ruby
The Future of Dependency Management for RubyHiroshi SHIBATA
 
An introduction and future of Ruby coverage library
An introduction and future of Ruby coverage libraryAn introduction and future of Ruby coverage library
An introduction and future of Ruby coverage librarymametter
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyHiroshi SHIBATA
 
How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHiroshi SHIBATA
 
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 RubyHiroshi SHIBATA
 

What's hot (20)

20140419 oedo rubykaigi04
20140419 oedo rubykaigi0420140419 oedo rubykaigi04
20140419 oedo rubykaigi04
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3
 
20140425 ruby conftaiwan2014
20140425 ruby conftaiwan201420140425 ruby conftaiwan2014
20140425 ruby conftaiwan2014
 
Gems on Ruby
Gems on RubyGems on Ruby
Gems on Ruby
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 Minutes
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and future
 
The Future of library dependency management of Ruby
 The Future of library dependency management of Ruby The Future of library dependency management of Ruby
The Future of library dependency management of Ruby
 
tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02
 
RubyGems 3 & 4
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mruby
 
OSS Security the hard way
OSS Security the hard wayOSS Security the hard way
OSS Security the hard way
 
The Future of Dependency Management for Ruby
The Future of Dependency Management for RubyThe Future of Dependency Management for Ruby
The Future of Dependency Management for Ruby
 
An introduction and future of Ruby coverage library
An introduction and future of Ruby coverage libraryAn introduction and future of Ruby coverage library
An introduction and future of Ruby coverage library
 
Gems on Ruby
Gems on RubyGems on Ruby
Gems on Ruby
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of Ruby
 
How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby Core
 
RubyGems 3 & 4
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4
 
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
 

Similar to O que tem de novo no Ruby 2.0?

Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar BatsovRuby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar BatsovMichael Kimathi
 
One RubyStack to Rule them All
One RubyStack to Rule them AllOne RubyStack to Rule them All
One RubyStack to Rule them Allelliando dias
 
Ruby 1.9 And Rails 3.0
Ruby 1.9 And Rails 3.0Ruby 1.9 And Rails 3.0
Ruby 1.9 And Rails 3.0ArrrrCamp
 
RubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on RailsRubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on Railselliando dias
 
The story of language development
The story of language developmentThe story of language development
The story of language developmentHiroshi SHIBATA
 
Úvod do Ruby on Rails
Úvod do Ruby on RailsÚvod do Ruby on Rails
Úvod do Ruby on RailsKarel Minarik
 
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and SpeedSalesforce Marketing Cloud
 
Ruby and Rails short motivation
Ruby and Rails short motivationRuby and Rails short motivation
Ruby and Rails short motivationjistr
 
CRuby Committers Who's Who in 2013
CRuby Committers Who's Who in 2013CRuby Committers Who's Who in 2013
CRuby Committers Who's Who in 2013nagachika t
 
Fisl - Deployment
Fisl - DeploymentFisl - Deployment
Fisl - DeploymentFabio Akita
 
.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011Fabio Akita
 
09 - Fábio Akita - Além do rails
09 - Fábio Akita - Além do rails09 - Fábio Akita - Além do rails
09 - Fábio Akita - Além do railsDNAD
 
An introduction to the ruby ecosystem
An introduction to the ruby ecosystemAn introduction to the ruby ecosystem
An introduction to the ruby ecosystemGeison Goes
 
Lambda Layers 로 람다함수 다이어트 하기 :: 이경우 - AWS Community Day 2019
Lambda Layers 로 람다함수 다이어트 하기 :: 이경우 - AWS Community Day 2019 Lambda Layers 로 람다함수 다이어트 하기 :: 이경우 - AWS Community Day 2019
Lambda Layers 로 람다함수 다이어트 하기 :: 이경우 - AWS Community Day 2019 AWSKRUG - AWS한국사용자모임
 
Ruby on Docker
Ruby on DockerRuby on Docker
Ruby on Dockerjasnow
 
Rocket Fuelled Cucumbers
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled CucumbersJoseph Wilk
 

Similar to O que tem de novo no Ruby 2.0? (20)

Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar BatsovRuby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
 
One RubyStack to Rule them All
One RubyStack to Rule them AllOne RubyStack to Rule them All
One RubyStack to Rule them All
 
Ruby 1.9 And Rails 3.0
Ruby 1.9 And Rails 3.0Ruby 1.9 And Rails 3.0
Ruby 1.9 And Rails 3.0
 
RubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on RailsRubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on Rails
 
The story of language development
The story of language developmentThe story of language development
The story of language development
 
Úvod do Ruby on Rails
Úvod do Ruby on RailsÚvod do Ruby on Rails
Úvod do Ruby on Rails
 
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
 
Ruby and Rails short motivation
Ruby and Rails short motivationRuby and Rails short motivation
Ruby and Rails short motivation
 
CRuby Committers Who's Who in 2013
CRuby Committers Who's Who in 2013CRuby Committers Who's Who in 2013
CRuby Committers Who's Who in 2013
 
Fisl - Deployment
Fisl - DeploymentFisl - Deployment
Fisl - Deployment
 
Deployment de Rails
Deployment de RailsDeployment de Rails
Deployment de Rails
 
.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011
 
09 - Fábio Akita - Além do rails
09 - Fábio Akita - Além do rails09 - Fábio Akita - Além do rails
09 - Fábio Akita - Além do rails
 
An introduction to the ruby ecosystem
An introduction to the ruby ecosystemAn introduction to the ruby ecosystem
An introduction to the ruby ecosystem
 
Lambda Layers 로 람다함수 다이어트 하기 :: 이경우 - AWS Community Day 2019
Lambda Layers 로 람다함수 다이어트 하기 :: 이경우 - AWS Community Day 2019 Lambda Layers 로 람다함수 다이어트 하기 :: 이경우 - AWS Community Day 2019
Lambda Layers 로 람다함수 다이어트 하기 :: 이경우 - AWS Community Day 2019
 
Ruby on Docker
Ruby on DockerRuby on Docker
Ruby on Docker
 
Rocket Fuelled Cucumbers
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled Cucumbers
 
Ruby Beyond Rails
Ruby Beyond RailsRuby Beyond Rails
Ruby Beyond Rails
 
Bhavesh ro r
Bhavesh ro rBhavesh ro r
Bhavesh ro r
 
Concurrency in ruby
Concurrency in rubyConcurrency in ruby
Concurrency in ruby
 

More from Fabio Akita

Devconf 2019 - São Carlos
Devconf 2019 - São CarlosDevconf 2019 - São Carlos
Devconf 2019 - São CarlosFabio Akita
 
Meetup Nerdzão - English Talk about Languages
Meetup Nerdzão  - English Talk about LanguagesMeetup Nerdzão  - English Talk about Languages
Meetup Nerdzão - English Talk about LanguagesFabio Akita
 
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018Fabio Akita
 
Desmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SPDesmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SPFabio Akita
 
Desmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter GoianiaDesmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter GoianiaFabio Akita
 
Blockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7MastersBlockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7MastersFabio Akita
 
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
Elixir  -Tolerância a Falhas para Adultos - GDG CampinasElixir  -Tolerância a Falhas para Adultos - GDG Campinas
Elixir -Tolerância a Falhas para Adultos - GDG CampinasFabio Akita
 
Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017Fabio Akita
 
30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to Ruby30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to RubyFabio Akita
 
Uma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TIUma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TIFabio Akita
 
THE CONF - Opening Keynote
THE CONF - Opening KeynoteTHE CONF - Opening Keynote
THE CONF - Opening KeynoteFabio Akita
 
A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017Fabio Akita
 
Desmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - APDesmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - APFabio Akita
 
A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017Fabio Akita
 
A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017Fabio Akita
 
A Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech DayA Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech DayFabio Akita
 
A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016Fabio Akita
 
Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016Fabio Akita
 
Conexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização PrematuraConexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização PrematuraFabio Akita
 
The Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All EvilThe Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All EvilFabio Akita
 

More from Fabio Akita (20)

Devconf 2019 - São Carlos
Devconf 2019 - São CarlosDevconf 2019 - São Carlos
Devconf 2019 - São Carlos
 
Meetup Nerdzão - English Talk about Languages
Meetup Nerdzão  - English Talk about LanguagesMeetup Nerdzão  - English Talk about Languages
Meetup Nerdzão - English Talk about Languages
 
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
 
Desmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SPDesmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SP
 
Desmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter GoianiaDesmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter Goiania
 
Blockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7MastersBlockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7Masters
 
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
Elixir  -Tolerância a Falhas para Adultos - GDG CampinasElixir  -Tolerância a Falhas para Adultos - GDG Campinas
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
 
Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017
 
30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to Ruby30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to Ruby
 
Uma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TIUma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TI
 
THE CONF - Opening Keynote
THE CONF - Opening KeynoteTHE CONF - Opening Keynote
THE CONF - Opening Keynote
 
A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017
 
Desmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - APDesmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - AP
 
A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017
 
A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017
 
A Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech DayA Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech Day
 
A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016
 
Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016
 
Conexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização PrematuraConexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização Prematura
 
The Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All EvilThe Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All Evil
 

Recently uploaded

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

O que tem de novo no Ruby 2.0?

  • 1. O que tem de novo no Ruby 2? Fabio Akita @akitaonrails codeminer42.com
  • 2.
  • 3.
  • 4. Ruby 0.95 Dez 1995 Ruby 1.8 Ago 2003 Rails 0.8 Dez 2005 Ruby 1.9 Dez 2007
  • 5. Ruby 0.95 Dez 1995 Ruby 1.8 Ago 2003 Rails 0.8 Dez 2005 Ruby 1.9 Dez 2007
  • 6. Ruby 0.95 Dez 1995 Ruby 1.8 Ago 2003 Rails 0.8 Dez 2005 Ruby 1.9 Dez 2007
  • 7. Ruby 0.95 Dez 1995 Ruby 1.8 Ago 2003 Rails 0.8 Dez 2005 Ruby 1.9 Dez 2007
  • 8. Ruby 2.0 24 de Fevereiro de 2013
  • 11. > %q[hello world] => "hello world" > %i[hello world] => [:hello, :world]
  • 13. def foo(options = {}) param1 = options[:param1] param2 = options[:param2] return [param1, param2] end > foo param1: "Hello", param2: "World" => ["Hello", "World"]
  • 14. def foo(param1: nil, param2: nil) return [param1, param2] end > foo param1: "Hello", param2: "World" => ["Hello", "World"]
  • 17. module Foo def self.included(base) base.class_eval do alias_method :original_to_s, :to_s def to_s original_to_s + ", Foo" end end end end class Array include Foo end
  • 18. > [1,2,3].to_s => "[1, 2, 3], Foo" > Array.ancestors => [Array, Foo, Enumerable, Object, Kernel, BasicObject]
  • 19. module Foo def to_s super + ", Foo" end end class Array prepend Foo end
  • 20. > [1,2,3].to_s => "[1, 2, 3], Foo" > Array.ancestors => [Foo, Array, Enumerable, Object, Kernel, BasicObject]
  • 22. > a = (0..3).map { |i| i } => [0, 1, 2, 3]
  • 23. > a = (0..3).lazy.map { |i| i } => #<Enumerator::Lazy: #<Enumerator::Lazy: 0..3>:map> > a.next => 0 > a.next => 1 > a.next => 2 > a.next => 3
  • 24. > a = (0..Float::INFINITY).lazy.map { |i| i } => #<Enumerator::Lazy: #<Enumerator::Lazy: 0..Infinity>:map> > a.next => 0 > a.next => 1 > a.next => 2 > a.next => 3
  • 26. module Foo def hello "Hello, #{to_s}" end end class Array include Foo end > [1,2,3].hello => "Hello, [1, 2, 3]"
  • 27. module Foo refine Array do def hello "Hello, #{to_s}" end end end using Foo > [1,2,3].hello => "Hello, [1, 2, 3]"
  • 28. module Foo def bah refine Array do [1,2,3].hello def hello end "Hello, #{to_s}" end > bah.hello end NoMethodError: undefined end method `hello' for "Hello, [1, 2, using Foo 3]":String > [1,2,3].hello => "Hello, [1, 2, 3]"
  • 30. curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled
  • 31.
  • 32.
  • 33.
  • 34.
  • 36.
  • 37.
  • 38.
  • 39.
  • 45. Browser Browser Browser Browser NGINX Worker Worker Worker Worker Rails Rails Rails Rails Ruby Ruby Ruby Ruby Linux
  • 46. Browser Browser Browser Browser NGINX Worker Worker Worker Worker Rails Rails Rails Rails Ruby Ruby Ruby Ruby Linux
  • 48. struct RBasic { VALUE flags; RString flags VALUE klass; klass };
  • 49. RString RString RString flags flags flags klass klass klass
  • 50. RString RString RString flags flags flags klass klass klass fork()
  • 51. RString RString RString flags flags flags klass klass klass fork()
  • 52. RString RString RString flags flags flags klass klass klass GC.start() RString RString RString flags flags flags klass klass klass
  • 53. OOBW Out of Band Work
  • 54.
  • 55.
  • 56. Lazy Lazy Sweep GC - Ruby 1.9.3
  • 58. RString RString RString flags flags flags klass klass klass
  • 59. RString RString RString flags flags flags klass klass klass
  • 60. RString RString RString flags flags flags klass klass klass
  • 61. RString RString RString flags flags flags klass klass klass
  • 62.
  • 64.
  • 65.
  • 66.
  • 67.
  • 69.
  • 70.
  • 71.
  • 72.
  • 74.
  • 75.
  • 76. 9 00001001 8 00001000 7 00000111
  • 77. 9 00001001 8 00001000 7 00000111
  • 78. 9 00001001 8 00001000 7 00000111
  • 79.
  • 80. 00000001 2^0 1 User 00000010 2^1 2 Moderator 00000100 2^2 4 Administrator
  • 81. 00000001 2^0 1 User 00000010 2^1 2 Moderator 00000100 2^2 4 Administrator
  • 82. 00000001 2^0 1 User 00000010 2^1 2 Moderator 00000100 2^2 4 Administrator
  • 83. 1 1 1 0 0 0 0 0 0 0 0
  • 84. 1 1 1 0 0 0 0 0 0 0 0 fork()
  • 87. Browser Browser Browser Browser NGINX Worker Worker Worker Worker Rails Rails Rails Rails Ruby Ruby Ruby Ruby Linux
  • 88. Browser Browser Browser Browser Browser Browser Browser Browser Browser Browser NGINX Worker Worker Worker Worker Worker Worker Worker Worker Worker Worker Rails Rails Rails Rails Rails Rails Rails Rails Rails Rails RubyRuby Ruby Ruby Ruby Ruby Ruby Ruby Ruby Ruby Linux
  • 89. Browser Browser Browser Browser Browser Browser Browser Browser Browser Browser NGINX Worker Worker Worker Worker Worker Worker Worker Worker Worker Worker Rails Rails Rails Rails Rails Rails Rails Rails Rails Rails RubyRuby Ruby Ruby Ruby Ruby Ruby Ruby Ruby Ruby Linux
  • 90. Rails 3.2.12+ Rails 4.0