Skip to content

Instantly share code, notes, and snippets.

@jesusangelm
Created January 20, 2012 21:31
Show Gist options
  • Save jesusangelm/1649716 to your computer and use it in GitHub Desktop.
Save jesusangelm/1649716 to your computer and use it in GitHub Desktop.
Script en Ruby para felicitar a una persona por su cumpleaños - Version POO
#!/usr/bin/env ruby
#coding: utf-8
# Felicitador V2.0 POO
class Cumple
def initialize(nombre, anios)
@minombre = nombre
@mianios = anios
end
def felicita
puts "Favor ingresa tu nombre"
@minombre = gets.chomp
puts "#{@minombre} cuantos años cumples???"
@mianios = gets.chomp.to_i
@mianios.times do |num|
puts "#{num.to_s} Feliz Cumpleaños #{@minombre}!!!"
end
end
end
cumpleanero = Cumple.new(@minombre, @mianios)
puts cumpleanero.felicita
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment