Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'pp'
- cities = {}
- File.open(File.dirname(__FILE__) + "/distance.txt").readlines.each_with_index do |line, index|
- columns = line.split(/\s+/)
- cities[columns.shift] = {
- :index => index,
- :distance => columns.map { |c| c =~ /\-/ ? nil : c.to_i }
- }
- end
- pp cities
Add Comment
Please, Sign In to add comment