From 3baada320eb4959a69f10b2daf414a0de538a958 Mon Sep 17 00:00:00 2001 From: kojix2 <2xijok@gmail.com> Date: Thu, 17 Sep 2020 10:38:59 +0900 Subject: [PATCH] Fix variables again --- lib/uplot/command.rb | 18 ++++++++---------- lib/uplot/command/parser.rb | 7 ++++++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/uplot/command.rb b/lib/uplot/command.rb index 86c50f8..077d3af 100644 --- a/lib/uplot/command.rb +++ b/lib/uplot/command.rb @@ -13,13 +13,7 @@ module Uplot def initialize @params = Params.new - @command = nil - @output = false - @count = false - @fmt = 'xyy' - @raw_inputs = [] - @debug = false @parser = Parser.new end @@ -27,11 +21,15 @@ module Uplot def run parser.parse_options - command = parser.command - params = parser.params + command = parser.command + params = parser.params delimiter = parser.delimiter transpose = parser.transpose - headers = parser.headers + headers = parser.headers + output = parser.output + count = parser.count + fmt = parser.fmt + debug = parser.debug if command == :colors Plot.colors @@ -65,7 +63,7 @@ module Uplot raise "unrecognized plot_type: #{command}" end.render($stderr) - print input if @output + print input if output end end end diff --git a/lib/uplot/command/parser.rb b/lib/uplot/command/parser.rb index 463cb69..e5ad17b 100644 --- a/lib/uplot/command/parser.rb +++ b/lib/uplot/command/parser.rb @@ -1,7 +1,8 @@ module Uplot class Command class Parser - attr_reader :command, :params, :main_parser, :sub_parsers, :delimiter, :transpose, :headers + attr_reader :command, :params, :main_parser, :sub_parsers, + :delimiter, :transpose, :headers, :output, :count, :fmt, :debug def initialize @sub_parsers = create_sub_parsers @@ -12,6 +13,10 @@ module Uplot @delimiter = "\t" @transpose = false @headers = nil + @output = false + @count = false + @fmt = 'xyy' + @debug = false end def create_default_parser