Skip to content

Instantly share code, notes, and snippets.

@jesusangelm
Created May 24, 2012 17:41
Show Gist options
  • Select an option

  • Save jesusangelm/2783008 to your computer and use it in GitHub Desktop.

Select an option

Save jesusangelm/2783008 to your computer and use it in GitHub Desktop.
simple script de prueba que lee el archivo de texto que se le pase como argumento.
#!/usr/bin/env ruby
def leer archivo
File.foreach(archivo).with_index do |linea, indice |
puts "#{indice}: #{linea}"
end
end
if ARGV.size > 1
puts "Este script solo admite un argumento!"
else
leer ARGV[0]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment