Permalink
Browse files

Adding support for Windows line endings.

  • Loading branch information...
1 parent f7ae8be commit 1296af80bc86d1dda9a12913578515c69cbefcb3 @JEG2 committed Feb 20, 2010
Showing with 4 additions and 2 deletions.
  1. +2 −0 .gitignore
  2. +2 −2 bin/log2html
View
@@ -1,2 +1,4 @@
log/*.log
log/*.html
+.DS_Store
+**/.DS_Store
View
@@ -21,7 +21,7 @@ File.foreach(ARGV.first) do |line|
case line
when /\ASETUP players:(\w+),(\w+)\b/
players << $1 << $2
- when /\ASHIPS (\w+)((?: [2-5]:[A-J](?:10|[1-9]):[HV]){5})\Z/
+ when /\ASHIPS (\w+)((?: [2-5]:[A-J](?:10|[1-9]):[HV]){5})\s*\z/
player = $1
ships[player] = Hash.new("water")
$2.strip.split.each do |ship|
@@ -40,7 +40,7 @@ File.foreach(ARGV.first) do |line|
ships[player][move(start, n, horizontal)] = "ship #{edge}"
end
end
- when /\ASHOTS (\w+)((?: [A-J](?:10|[1-9]):(?:hit|miss))+)\Z/
+ when /\ASHOTS (\w+)((?: [A-J](?:10|[1-9]):(?:hit|miss))+)\s*\z/
player = $1
other = player == players.first ? players.last : players.first
shots[other] ||= Hash.new(%w[empty &nbsp;])

0 comments on commit 1296af8

Please sign in to comment.