1. MAC address is not useful for determining location.
2. IP address can be useful for determining location, because it can sometimes be associated with a known location, in a very broad sense (country, region, city). The OS already does this for you when you ask it to determine location. If GPS, cell tower, and WiFi data is not available, it will fall back to IP address.
3. If you want to determine IP address or MAC address for some other purpose, or want do your own IP-to-location lookup against some database, you can determine IP address and MAC address using the socket support in Ruby:
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/socket/rdoc/index.html