Rewrite of iptabs in ruby