about summary refs log tree commit diff stats
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-rwxr-xr-xdata/generate.rb21
1 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