Rakefile in louis-1.2.0 vs Rakefile in louis-2.0.0
- old
+ new
@@ -10,14 +10,19 @@
desc "Pre-parse the source file into the parsed file"
task :parse_data_file => [:environment] do
include Louis::Helpers
- lookup_table = []
+ lookup_table = {}
File.open(Louis::ORIGINAL_OUI_FILE).each_line do |line|
- res = line_parser(line)
- lookup_table.push(res) if res
+ next unless (res = line_parser(line))
+
+ lookup_table[res['mask']] ||= {}
+ lookup_table[res['mask']][res['prefix'].to_s] = {
+ 's' => res['short_vendor'],
+ 'l' => res['long_vendor']
+ }
end
File.write(Louis::PARSED_DATA_FILE, JSON.generate(lookup_table))
end