Code snippet: can it be done better/shorter?


#1

AFAIC See, this works all right, but my question is, just to learn the
Ruby style,
can this be done shorter (better)?

class LineChecker
def checkline(line)
if line =~ /Checking:/
line =~ /<(.?)>.<(.*)>/
from = $1; rcpt = $2
from = “Unknown” if from == “”
rcpt = “Unknown” if rcpt == “”
return ([from,rcpt])
elsif line =~ /ClamAV-clamd\ result:\ /
return $’
else·
return []·
end

end
end

Cheers,
Krekna