diff options
-rwxr-xr-x | data/generate.rb | 21 | ||||
-rw-r--r-- | screenshot.png | bin | 43566 -> 185832 bytes |
2 files changed, 10 insertions, 11 deletions
diff --git a/data/generate.rb b/data/generate.rb index bc85b93b..52a4c8e4 100755 --- a/data/generate.rb +++ b/data/generate.rb @@ -1,22 +1,21 @@ #!/usr/bin/ruby ## Parses mime.types and creates mime.dat -file = File.read(ARGV[0] || "mime.types") +file = File.read(ARGV.first || "mime.types") table = {} -for l in file.lines - next if l[0] == ?# - next unless l.size > 3 - next unless l.include? ?\t +for line in file.lines + next if line[0] == ?# or + line.size <= 3 or + !line.include?( ?\t ) - left, *exts = l.split(/\s+/) -# print exts.inspect - for ext in exts - table[ext] = left + name, *extensions = line.split(/\s+/) + for ext in extensions + table[ext] = name end end -File.open('mime.dat', 'w') do |f| - f.write Marshal.dump(table) +File.open( 'mime.dat', 'w' ) do |f| + f.write Marshal.dump( table ) end diff --git a/screenshot.png b/screenshot.png index 9a38dd4d..a3282d76 100644 --- a/screenshot.png +++ b/screenshot.png Binary files differ |