This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Gladiator | |
attr_accessor :name, :weapon | |
def self.filepath | |
'combat.csv' | |
end | |
def filepath | |
Gladiator.filepath | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './user.rb' | |
def mainmenu | |
puts 'select an option please | |
1.- new user | |
2.- delete user | |
3.- consult user | |
4.- exit | |
type a number: ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
Ok, me tome la libertad de llenar este programa de comentarios | |
en virtud de que quede super bien entendido ¿ok?, trataré de | |
comentarlo a nivel noobie. | |
=end | |
headers = nil #aqui almacenaremos los headers (les dije que nivel noobie!) | |
rows = [] #se declara un array que de momento esta vacio, aqui guardaremos las filas | |
File.open(ARGV[0] || 'data.csv', 'r') do |file| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
headers = nil | |
rows = [] | |
File.open(ARGV[0] || 'data.csv', 'r') do |file| | |
headers = file.gets.split(',') | |
while(line = file.gets) do | |
cols = line.split(',') | |
rows << cols | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
headers = nil | |
rows = [] | |
File.open(ARGV[0] || 'data.csv', 'r') do |file| | |
headers = file.gets.split(',') | |
while(line = file.gets) do | |
cols = line.split(',') | |
rows << cols | |
end |