0
Hello. I can’t print variable that is inside a def.
Script
class Logparser
def initialize(ip, data, code)
log = File.open("/project/log_sec/log/log.txt").each do |file|
parse = file.split(" ")
data = parse[0]
time = parse[1]
@ip = parse[2]
method = parse[3]
url = parse[4]
code = parse[5]
ref = parse[8]
useragent = parse[9]
end
end
def displayparse()
puts "IP #@ip"
end
Puts @IP shows nothing