Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Aug 27, 2011
1 parent 27dce3c commit c9efde8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bin/pru
Expand Up @@ -55,21 +55,21 @@ map = 'true' if not map or map.empty?
if options[:file]
output_lines = []
input = File.read(options[:file])
newline = input[/\r\n|\r|\n/] || "\n"
newline = input[/\r\n|\r|\n/]
else
input = $stdin
end

output = lambda{|line|
collector = lambda{|line|
output_lines ? output_lines << line : puts(line)
}

if reduce
results = []
Pru.map(input, map){|usage| results << usage }
output.call Pru.reduce(results, reduce)
Pru.map(input, map){|out| results << out }
collector.call Pru.reduce(results, reduce)
else
Pru.map(input, map){|usage| output.call usage }
Pru.map(input, map){|out| collector.call out }
end

if options[:file]
Expand Down

0 comments on commit c9efde8

Please sign in to comment.