introducción al ruby
DESCRIPTION
Introducción al Ruby, Master en Desarrollo e Integración de Soluciones SoftwareTRANSCRIPT
![Page 1: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/1.jpg)
Introducción al Ruby
Máster Universitario en Desarrollo e Integración de Soluciones Software
Universidad de Deusto
![Page 2: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/2.jpg)
Historia
• 1993
• primera versión pública 1995
• en inglés 1999
![Page 3: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/3.jpg)
¿Por qué?
• Simple y bonito
• Fácil de aprender
• Libre y de código abierto
• Muchas librerías y comunidad innovadora
• Ruby on Rails
![Page 4: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/4.jpg)
Matz
Yukihiro “matz” Matsumoto
“Programmers often feel joy when they can concentrateon the creative side of programming,
so Ruby is designed to make programmers happy.”
![Page 5: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/5.jpg)
Felices ...
• ¿A quién le importa?
![Page 6: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/6.jpg)
El plan
• Introducción al Ruby
• Pequeñas pruebas
• Martes -- Viernes: Rails
![Page 7: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/7.jpg)
Características
• Interpretado
• Las variables no se declaran
• El tipado es dinámico
• Sintaxis simple y consistente
• Gestión de memoria automática
![Page 8: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/8.jpg)
Objetos
• Todo es un objeto
• Clases, métodos, herencia
• Singletons
• “mixins”
![Page 9: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/9.jpg)
Hola Mundo
![Page 10: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/10.jpg)
Hola Mundo
![Page 11: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/11.jpg)
Todo es objeto
![Page 12: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/12.jpg)
Numbers
![Page 13: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/13.jpg)
String
![Page 14: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/14.jpg)
Conversión entre tipos
![Page 15: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/15.jpg)
Range
![Page 16: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/16.jpg)
Array
![Page 17: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/17.jpg)
Hash
![Page 18: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/18.jpg)
if
![Page 19: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/19.jpg)
postfix if
![Page 20: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/20.jpg)
el resto
Para el resto: case, while, until, for ... ver elRuby Cheatsheet
![Page 21: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/21.jpg)
métodos
![Page 22: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/22.jpg)
argumentos
![Page 23: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/23.jpg)
argumentos
![Page 24: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/24.jpg)
argumentos
![Page 25: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/25.jpg)
argumentos
![Page 26: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/26.jpg)
blocks
![Page 27: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/27.jpg)
blocks
![Page 28: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/28.jpg)
blocks
![Page 29: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/29.jpg)
blocks y arrays
![Page 30: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/30.jpg)
yield
![Page 31: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/31.jpg)
clases
![Page 32: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/32.jpg)
herencia
![Page 33: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/33.jpg)
mixins
![Page 34: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/34.jpg)
RMI estilo Ruby
![Page 35: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/35.jpg)
gems
![Page 36: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/36.jpg)
![Page 37: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/37.jpg)
![Page 38: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/38.jpg)
misc
![Page 39: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/39.jpg)
Ruby VMs
![Page 40: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/40.jpg)
prácticas
![Page 41: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/41.jpg)
también http://sqlitebrowser.sourceforge.net/
![Page 42: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/42.jpg)
Pruebas
• servidor: ror.deusto.efaber.net
• IP: 82.103.140.74
• cuenta: rorn
• contraseña inicial: secretn
• puerto personal: 300n n=1,...,29
![Page 43: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/43.jpg)
irb
![Page 44: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/44.jpg)
Pi
![Page 45: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/45.jpg)
Pi
![Page 46: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/46.jpg)
“worker”
![Page 47: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/47.jpg)
“master”
![Page 48: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/48.jpg)
Ejemplo 2: GPS tracker
![Page 49: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/49.jpg)
![Page 50: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/50.jpg)
![Page 51: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/51.jpg)
![Page 52: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/52.jpg)
![Page 53: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/53.jpg)
gem install fusion_tables
![Page 54: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/54.jpg)
![Page 55: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/55.jpg)
http://ror.deusto.efaber.net:4567/geo
![Page 56: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/56.jpg)
Sinatragem install sinatra
ruby hola.rb
![Page 57: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/57.jpg)
![Page 58: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/58.jpg)
![Page 59: Introducción al Ruby](https://reader033.vdocuments.mx/reader033/viewer/2022052900/55628ae2d8b42aa17d8b49f0/html5/thumbnails/59.jpg)