SlideShare una empresa de Scribd logo
1 de 91
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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 a 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 a 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
 

Más de 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
 

Más de 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
 

Último

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Último (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

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