Skip to content

Commit

Permalink
#20 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed Nov 4, 2014
1 parent 80f7b7d commit 9ff1df4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pdd/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def puzzle(lines, match, idx)
begin
tail = tail(lines, match[1])
rescue Error => ex
raise Error, "#{ex.message} line ##{idx}"
raise Error, "#{ex.message} in line ##{idx}"
end
body = (match[3] + ' ' + tail.join(' ')).gsub(/\s+/, ' ').strip
Puzzle.new(
Expand All @@ -90,7 +90,7 @@ def tail(lines, prefix)
lines
.take_while { |txt| txt.start_with?(prefix) }
.map { |txt| txt[prefix.length, txt.length] }
.take_while { |txt| txt =~ /^[ a-zA-Z0-9\-_]/ }
.take_while { |txt| txt =~ /^[ a-zA-Z0-9]/ }
.each { |txt| fail Error, 'Space expected' unless txt.start_with?(' ') }
.each { |txt| fail Error, 'Too many spaces' if txt =~ /^\s{2,}/ }
.map { |txt| txt[1, txt.length] }
Expand Down

0 comments on commit 9ff1df4

Please sign in to comment.