Skip to content

Instantly share code, notes, and snippets.

@joseluistorres
Created November 18, 2013 15:16
Show Gist options
  • Select an option

  • Save joseluistorres/7529435 to your computer and use it in GitHub Desktop.

Select an option

Save joseluistorres/7529435 to your computer and use it in GitHub Desktop.
Ejemplo para Duck Typing
class BuenFin
def revisa_oferta(objetos_a_validar)
objetos_a_validar.each do |objeto|
case objeto
when PantallaPlana
objeto.checar_cuanto_cuesta_y_a_cuantos_meses
when Celular4taGeneracion
objeto.checar_si_tiene_garantia
when MueblesCaros
objeto.ver_cuanto_y_porque_tan_caro
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment