Skip to content
Browse files

Add a task to quickly convert from a comma separated list of hexadeci…

…mal character ranges.
  • Loading branch information...
1 parent 4cc7901 commit 746eb45acd3b84e5fe678a4f7137e6f5ae13d896 Matt Colyer committed Oct 14, 2010
Showing with 17 additions and 0 deletions.
  1. +17 −0 Rakefile
View
17 Rakefile
@@ -74,6 +74,22 @@ def failure(message)
exit -1
end
+desc "Take a comma separated list of hex values and print a list of characters and ranges"
+task :convert, [:file] do |t, args|
+ data = File.read(args.file)
+ ranges = data.split(",")
+ ranges = ranges.map do |range|
+ if range.include? '-'
+ range = range.split("-").map{ |s| s.to_i(16) }
+ "!ruby/range #{range[0]}..#{range[1]}"
+ else
+ range.to_i(16)
+ end
+ end
+
+ puts ranges.to_yaml.gsub("\"","")
+end
+
desc "Verifies that a language loads correctly."
task :test, [:language] do |t, args|
unless args.language
@@ -140,6 +156,7 @@ task :visualize, [:language] do |t, args|
</html>
eos
+ `open #{filename}`
success "Open #{filename} to view the results"
end
end

0 comments on commit 746eb45

Please sign in to comment.
Something went wrong with that request. Please try again.