ruby

Download Ruby

If you can't read please download the document

Upload: filipe-giusti

Post on 16-Apr-2017

470 views

Category:

Technology


0 download

TRANSCRIPT

Ruby

Elegncia 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 Dinmica

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 so objetos.

(Quase) Todas as interaes so feitas com troca de mensagens

1 + 1

1.+(1)

1.send('+', 1)

Ruby Objetos e Mensagens

Ruby - features

Suporte a introspeco (respond_to)

Redefinio de mtodos

Classes abertas

method_missing

Sem overload de mtodos

Herana mltipla com mixins

const_missing

Ruby - Tools

Gems

bundle

WebserversThin

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 aplicaes web

Viewshaml :index

Helpersenable :sessions