Ruby: How to convert IP range to array of IP's

Viewed 2804

Is there any easy way to convert IP range to array of IPs?

def convertIPrange (start_ip, end_ip)
 #output: array of ips end
end

e.g. input

('192.168.1.105', '192.168.1.108') 

output

['192.168.1.105','192.158.1.106','192.158.1.107','192.158.1.108']
2 Answers
Related