yeah, I think you inherit RHOSTS from Msf::Auxiliary::Scanner and you can just call hosts.each I think, like in https://github.com/rapid7/metasploit-framework/blob/master/modules/auxiliary/scanner/portscan/syn.rb