# File lib/domainatrix/domain_parser.rb, line 12 def read_dat_file(file_name) # If we're in 1.9, make sure we're opening it in UTF-8 if RUBY_VERSION >= '1.9' dat_file = File.open(file_name, "r:UTF-8") else dat_file = File.open(file_name) end dat_file.each_line do |line| line = line.strip unless (line =~ /\/\//) || line.empty? parts = line.split(".").reverse sub_hash = @public_suffixes parts.each do |part| sub_hash = (sub_hash[part] ||= {}) end end end end