The only difference between the addresses is a single version-byte that ends up defining the first character of the address. Bitcoin-ruby has the definition for several networks, including namecoin, litecoin and dogecoin.
To use a different network, just set it before doing anything else:
Bitcoin.network = :namecoin
Now you can generate a namecoin address like usual:
Bitcoin.generate_address
or:
Bitcoin::Key.generate