8000 quote the argument of timefmt · ruby-numo/numo-gnuplot@f79b2e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit f79b2e6

Browse files
committed
quote the argument of timefmt
1 parent dae976d commit f79b2e6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/numo/gnuplot.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,10 @@ def parse(*opts)
498498
if opts.first.kind_of?(String)
499499
a << OptArg.quote(opts.shift)
500500
end
501+
when NEED_QUOTE_TIME
502+
if opts.first.kind_of?(String)
503+
a << OptArg.quote_time(opts.shift)
504+
end
501505
when NEED_QUOTE
502506
if opts.first.kind_of?(String)
503507
a << OptArg.quote(opts.shift)
@@ -516,6 +520,12 @@ def parse(*opts)
516520
a.join(sep)
517521
end
518522

523+
NEED_QUOTE_TIME = /^timef(mt?)?/
524+
525+
def quote_time(s)
526+
"\"\\\"#{s}\\\"\""
527+
end
528+
519529
NEED_QUOTE = %w[
520530
background
521531
cblabel
@@ -613,6 +623,8 @@ def parse_kv(s,v)
613623
else
614624
"#{k} #{parse(v)}"
615625
end
626+
when NEED_QUOTE_TIME
627+
"#{k} #{OptArg.quote_time(v)}"
616628
when NEED_QUOTE
617629
case v
618630
when String

0 commit comments

Comments
 (0)
0