title: Removing the last IP Address Octet in Ruby
body: <p>In Ruby, I'm wanting to take my local IP address and convert it into my network id (e.g. 192.168.1.1 to 192.168.1.0)</p>
  
  <pre><code>require "socket"
  local_ip = UDPSocket.open {|s| s.connect("64.233.187.99", 1); s.addr.last}
  </code></pre>
  
  <p>This will give me my local ip, but how can I remove the last octet up to the dot(.)?</p>