hello ruby!
TRANSCRIPT
![Page 1: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/1.jpg)
Hello Ruby!Victoria A. Ubaldo Gamarra
![Page 2: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/2.jpg)
¿Qué es Ruby ?● Ruby es un lenguaje de programación dinámico orientado a
objetos
● Se originó en Japón a mediados de la década de 1990 ,desarrollado y diseñado por Yukihiro "Matz" Matsumoto.
● Soporta múltiples paradigmas de programación, incluyendo funcional, orientado a objetos, imperativo y reflexivo.
● Similar en varios aspectos a Python, Perl, Lisp, Dylan, Pike, y CLU.
![Page 3: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/3.jpg)
![Page 4: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/4.jpg)
![Page 5: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/5.jpg)
● http://tryruby.org ● http://railsinstaller.org/en
¿Cómo empiezo?
![Page 6: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/6.jpg)
Let’s Start!
![Page 7: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/7.jpg)
Números
![Page 8: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/8.jpg)
Cálculos simplesProbemos : 4*56-14/5
puts 5 * (12 - 8) + -15
puts 98 + (59872 / (13 * 8)) * -
52
![Page 9: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/9.jpg)
Textos
![Page 10: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/10.jpg)
Ingresemos un texto..Ejemplo: “Vicky”“Hello World”
Hemos formado un String .
Intentemos los métodos “Texto”.reverse“Texto”.length
![Page 11: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/11.jpg)
Método reverse usado para String.
![Page 12: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/12.jpg)
Aritmética de texto
![Page 13: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/13.jpg)
Probemos
puts 12 + 12
puts "12" + "12"
puts "12 + 12"
puts 15 + “15”
![Page 14: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/14.jpg)
Variables
![Page 15: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/15.jpg)
Asignar variables
myString
myString=”hola
Mundo”
![Page 16: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/16.jpg)
Arrays [ ]● Es una secuencia de datos.
![Page 17: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/17.jpg)
Almacenar un array en una variable
![Page 18: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/18.jpg)
Método .sort (Ordenar)
![Page 19: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/19.jpg)
Matrices e Iteraciones
![Page 20: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/20.jpg)
Matriz[ ][ 10 ][ ‘Pizza’, ‘Hamburguesa’ ][45, rosa , [true, false]]
![Page 21: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/21.jpg)
Probemos
names = ['Juan', 'Carlos', ‘Teresa']
puts names[0]
puts names[1]
puts names[2]
![Page 22: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/22.jpg)
EachProbemos :
lenguajes = ['Inglés', 'Alemán', 'Ruby']
lenguajes.each do |leng|
puts '¡Me gusta ' + leng + '!'
puts '¿A ti?'
end
![Page 23: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/23.jpg)
Conversiones
![Page 24: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/24.jpg)
Algunos métodos
● to_s convierte valores a String
● to_i convierte valores a Enteros(numbers.)
● to_a convierte valores a Arrays
● to_f para puntos flotantes
![Page 25: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/25.jpg)
![Page 26: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/26.jpg)
Probemos:
puts '15’.to_f
puts '99.999'.to_i
puts '99.999'.to_f
puts '9 es el número'.to_i
Y qué pasa aqui? ->
![Page 27: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/27.jpg)
Gets
Probamos:
puts gets
![Page 28: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/28.jpg)
Gets
![Page 29: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/29.jpg)
Métodos Propios
![Page 30: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/30.jpg)
Probemos:
def mensaje puts ‘Hora de almorzar !!’end
![Page 31: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/31.jpg)
Variables Localesdef duplicaEsto num
numeroVeces2 = num*2
puts num.to_s+' el doble es
'+numeroVeces2.to_s
end
duplicaEsto 22
![Page 32: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/32.jpg)
Clases
![Page 33: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/33.jpg)
Creando Clases
![Page 34: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/34.jpg)
Time
![Page 35: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/35.jpg)
Hash
![Page 36: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/36.jpg)
Extendiendo las clases
![Page 37: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/37.jpg)
Bloques
![Page 38: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/38.jpg)
![Page 39: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/39.jpg)
Rails
![Page 40: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/40.jpg)
Ingresemos aquíhttp://es.railsbridge.org/installfest/escoge_tu_sistema_operativo?back=installfest%23step3
http://es.railsbridge.org/installfest/windows
![Page 41: Hello Ruby!](https://reader035.vdocuments.net/reader035/viewer/2022081507/58ef2dad1a28ab19318b4613/html5/thumbnails/41.jpg)
Sigamos practicandohttps://pine.fm/LearnToProgram/chap_00.htmlhttp://tryruby.org/levels/1/challenges/0 https://www.ruby-lang.org/es/documentation/