Improved permeability on pipelines

This commit is contained in:
kojix2 2020-07-30 10:37:20 +09:00
parent 203e48e0ed
commit 958ce45635

View File

@ -37,17 +37,20 @@ module Uplot
end end
def run def run
input_lines = readlines.map(&:chomp) # Sometimes the input file does not end with a newline code.
while input = Kernel.gets(nil)
input_lines = input.split(/\R/)
case @ptype case @ptype
when 'hist', 'histogram' when 'hist', 'histogram'
histogram(input_lines).render histogram(input_lines)
when 'line', 'lineplot' when 'line', 'lineplot'
line(input_lines).render line(input_lines)
when 'lines' when 'lines'
lines(input_lines).render lines(input_lines)
end end.render($stderr)
puts input_lines if @params[:p] print input if @params[:p]
end
end end
def histogram(input_lines) def histogram(input_lines)