YouPlot/lib/youplot/parameters.rb

35 lines
538 B
Ruby
Raw Permalink Normal View History

2021-05-27 20:15:06 +08:00
# frozen_string_literal: true
module YouPlot
# UnicodePlot parameters.
2021-05-29 09:28:56 +08:00
# Why Struct, not Hash?
2021-05-27 20:15:06 +08:00
# * 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