K
Krekna Mektek
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 =3D~ /Checking:/
line =3D~ /<(.*?)>.*<(.*)>/
from =3D $1; rcpt =3D $2
from =3D "Unknown" if from =3D=3D ""
rcpt =3D "Unknown" if rcpt =3D=3D ""
return ([from,rcpt])
elsif line =3D~ /ClamAV-clamd\ result:\ /
return $'
else=B7
return []=B7
end
end
end
Cheers,
Krekna
Ruby style,
can this be done shorter (better)?
class LineChecker
def checkline(line)
if line =3D~ /Checking:/
line =3D~ /<(.*?)>.*<(.*)>/
from =3D $1; rcpt =3D $2
from =3D "Unknown" if from =3D=3D ""
rcpt =3D "Unknown" if rcpt =3D=3D ""
return ([from,rcpt])
elsif line =3D~ /ClamAV-clamd\ result:\ /
return $'
else=B7
return []=B7
end
end
end
Cheers,
Krekna