Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CW 31: Ruby - Filipe Giusti

CW 31: Ruby - Filipe Giusti

Avatar for hackthursday

hackthursday

August 02, 2012
Tweet

More Decks by hackthursday

Other Decks in Programming

Transcript

  1. Ruby • Tipo de linguagem • Interpretadores • Sintaxe •

    Objetos & Mensagens • Features • Tools • Rack • Rails • Sinatra
  2. Ruby - Interpretadores • MRI - Matz's Ruby Interpreter •

    YARV - Yet Another Ruby VirtualMachine • Jruby - JVM • Rubinius – Ruby em Ruby • IronRuby - .NET • MacRuby – Objective C
  3. Ruby – Tipo de linguagem • Tipagem Dinâmica • OO

    • Fortemente tipada • Garbage collection
  4. Ruby - Sintaxe • Constante • ::EscopoGlobal • variavel_local •

    @variavel_de_objeto • @@variavel_de_class • 2 • 2.3 • “string #{interpolada}”
  5. 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!' }
  6. Ruby - Sintaxe • 3.times do; puts 'Hurra!'; end •

    1..10 • Imprimir ímpares de 1 a 20 em ordem inversa
  7. 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)
  8. 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
  9. Ruby - Tools • Gems • bundle • Webservers •

    Thin • Passenger • Unicorn • JVM • RVM e rbenv
  10. Ruby - Sinatra • DSL para aplicações web • Views

    • haml :index • Helpers • enable :sessions