Ruby




Elegância e expressividade
Ruby
●   Tipo de linguagem
●   Interpretadores
●   Sintaxe
●   Objetos & Mensagens
●   Features
●   Tools
●   Rack
●   Rails
●   Sinatra
Ruby - Interpretadores
●   MRI - Matz's Ruby Interpreter
●   YARV - Yet Another Ruby VirtualMachine
●   Jruby - JVM
●   Rubinius – Ruby em Ruby
●   IronRuby - .NET
●   MacRuby – Objective C
Ruby – Tipo de linguagem
●   Tipagem Dinâmica
●   OO
●   Fortemente tipada
●   Garbage collection
Ruby - Sintaxe
●   Constante
●   ::EscopoGlobal
●   variavel_local
●   @variavel_de_objeto
●   @@variavel_de_class
●   2
●   2.3
●   “string #{interpolada}”
Ruby - Sintaxe
●   :symbol
●   [1, 2]
●   { :ola => 'voce' } ou { ola: 'voce' }
●   raise HelpError unless world.is_safe?
●   drink while ! beer.nil?
●   for nerd in @dj_house; nerd.eat(meat); end
●   case; when; default; end
●   3.times { puts 'Hurra!' }
Ruby - Sintaxe
●   3.times do; puts 'Hurra!'; end
●   1..10



●   Imprimir ímpares de 1 a 20 em ordem inversa
Ruby – Objetos e Mensagens
●   (Quase) Tudo são objetos.
●   (Quase) Todas as interações são feitas com
    troca de mensagens

●   1+1
●   1.+(1)
●   1.send('+', 1)
Ruby – Objetos e Mensagens
Ruby - features
●   Suporte a introspecção (respond_to)
●   Redefinição de métodos
●   Classes abertas
●   method_missing
●   Sem overload de métodos
●   Herança múltipla com mixins
●   const_missing
Ruby - Tools
●   Gems
●   bundle
●   Webservers
    ●   Thin
    ●   Passenger
    ●   Unicorn
    ●   JVM
●   RVM e rbenv
Ruby - Rack
●   Ruby Webserver Interface
●   API minimalista para os frameworks web
●   config.ru
Ruby - Rails
●   MVC
●   Routing
●   Middleware
●   Migrations
●   Helpers
Ruby - Sinatra
●   DSL para aplicações web
●   Views
    ●   haml :index
●   Helpers
    ●   enable :sessions

Ruby

  • 1.
  • 2.
    Ruby ● Tipo de linguagem ● Interpretadores ● Sintaxe ● Objetos & Mensagens ● Features ● Tools ● Rack ● Rails ● Sinatra
  • 3.
    Ruby - Interpretadores ● MRI - Matz's Ruby Interpreter ● YARV - Yet Another Ruby VirtualMachine ● Jruby - JVM ● Rubinius – Ruby em Ruby ● IronRuby - .NET ● MacRuby – Objective C
  • 4.
    Ruby – Tipode linguagem ● Tipagem Dinâmica ● OO ● Fortemente tipada ● Garbage collection
  • 5.
    Ruby - Sintaxe ● Constante ● ::EscopoGlobal ● variavel_local ● @variavel_de_objeto ● @@variavel_de_class ● 2 ● 2.3 ● “string #{interpolada}”
  • 6.
    Ruby - Sintaxe ● :symbol ● [1, 2] ● { :ola => 'voce' } ou { ola: 'voce' } ● raise HelpError unless world.is_safe? ● drink while ! beer.nil? ● for nerd in @dj_house; nerd.eat(meat); end ● case; when; default; end ● 3.times { puts 'Hurra!' }
  • 7.
    Ruby - Sintaxe ● 3.times do; puts 'Hurra!'; end ● 1..10 ● Imprimir ímpares de 1 a 20 em ordem inversa
  • 8.
    Ruby – Objetose Mensagens ● (Quase) Tudo são objetos. ● (Quase) Todas as interações são feitas com troca de mensagens ● 1+1 ● 1.+(1) ● 1.send('+', 1)
  • 9.
    Ruby – Objetose Mensagens
  • 10.
    Ruby - features ● Suporte a introspecção (respond_to) ● Redefinição de métodos ● Classes abertas ● method_missing ● Sem overload de métodos ● Herança múltipla com mixins ● const_missing
  • 11.
    Ruby - Tools ● Gems ● bundle ● Webservers ● Thin ● Passenger ● Unicorn ● JVM ● RVM e rbenv
  • 12.
    Ruby - Rack ● Ruby Webserver Interface ● API minimalista para os frameworks web ● config.ru
  • 13.
    Ruby - Rails ● MVC ● Routing ● Middleware ● Migrations ● Helpers
  • 14.
    Ruby - Sinatra ● DSL para aplicações web ● Views ● haml :index ● Helpers ● enable :sessions