mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-06 15:11:12 +08:00
Move Plot::Params to Parameters
This commit is contained in:
parent
54b70f1f27
commit
7c42d9a444
@ -3,6 +3,7 @@
|
|||||||
require 'unicode_plot'
|
require 'unicode_plot'
|
||||||
require 'youplot/version'
|
require 'youplot/version'
|
||||||
require 'youplot/dsv'
|
require 'youplot/dsv'
|
||||||
|
require 'youplot/parameters'
|
||||||
require 'youplot/command'
|
require 'youplot/command'
|
||||||
|
|
||||||
module YouPlot
|
module YouPlot
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
require_relative 'options'
|
require_relative 'options'
|
||||||
require_relative 'plot_params'
|
|
||||||
|
|
||||||
module YouPlot
|
module YouPlot
|
||||||
class Command
|
class Command
|
||||||
@ -28,7 +27,7 @@ module YouPlot
|
|||||||
debug: false
|
debug: false
|
||||||
)
|
)
|
||||||
|
|
||||||
@params = PlotParams.new
|
@params = Parameters.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_default_parser
|
def create_default_parser
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module YouPlot
|
|
||||||
class Command
|
|
||||||
# UnicodePlot parameters.
|
|
||||||
# * Normally in a Ruby program, you might use hash for the parameter object.
|
|
||||||
# * Here, I use Struct for 2 safety reason.
|
|
||||||
# * The keys are static in Struct.
|
|
||||||
# * Struct does not conflict with keyword arguments. Hash dose.
|
|
||||||
PlotParams = Struct.new(
|
|
||||||
# Sort me!
|
|
||||||
:title,
|
|
||||||
:width,
|
|
||||||
:height,
|
|
||||||
:border,
|
|
||||||
:margin,
|
|
||||||
:padding,
|
|
||||||
:color,
|
|
||||||
:xlabel,
|
|
||||||
:ylabel,
|
|
||||||
:labels,
|
|
||||||
:symbol,
|
|
||||||
:xscale,
|
|
||||||
:nbins,
|
|
||||||
:closed,
|
|
||||||
:canvas,
|
|
||||||
:xlim,
|
|
||||||
:ylim,
|
|
||||||
:grid,
|
|
||||||
:name
|
|
||||||
) do
|
|
||||||
def to_hc
|
|
||||||
to_h.compact
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
35
lib/youplot/parameters.rb
Normal file
35
lib/youplot/parameters.rb
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module YouPlot
|
||||||
|
# UnicodePlot parameters.
|
||||||
|
# * Normally in a Ruby program, you might use hash for the parameter object.
|
||||||
|
# * Here, I use Struct for 2 safety reason.
|
||||||
|
# * The keys are static in Struct.
|
||||||
|
# * Struct does not conflict with keyword arguments. Hash dose.
|
||||||
|
Parameters = Struct.new(
|
||||||
|
# Sort me!
|
||||||
|
:title,
|
||||||
|
:width,
|
||||||
|
:height,
|
||||||
|
:border,
|
||||||
|
:margin,
|
||||||
|
:padding,
|
||||||
|
:color,
|
||||||
|
:xlabel,
|
||||||
|
:ylabel,
|
||||||
|
:labels,
|
||||||
|
:symbol,
|
||||||
|
:xscale,
|
||||||
|
:nbins,
|
||||||
|
:closed,
|
||||||
|
:canvas,
|
||||||
|
:xlim,
|
||||||
|
:ylim,
|
||||||
|
:grid,
|
||||||
|
:name
|
||||||
|
) do
|
||||||
|
def to_hc
|
||||||
|
to_h.compact
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user