Skip to content

Commit

Permalink
convert if/elsif to case
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Apr 22, 2011
1 parent d035cd0 commit 42f34fa
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/pru.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ def _pru(i)
io.each_line do |line|
i += 1
line.chomp!
result = line._pru(i)
if result == true
yield line
elsif result.is_a?(Regexp)
yield line if line =~ result
elsif result
yield result
result = line._pru(i) or next

case result
when true then yield line
when Regexp then yield line if line =~ result
else yield result
end
end
end
Expand Down

0 comments on commit 42f34fa

Please sign in to comment.