Method: UnicodePlot::Stemplot.factory
- Defined in:
- lib/unicode_plot/stemplot.rb
.factory(vector, **kw) ⇒ NumericStemplot, StringStemplot
Factory method to create a Stemplot, creates either a NumericStemplot or StringStemplot depending on input.
94 95 96 97 98 99 100 101 |
# File 'lib/unicode_plot/stemplot.rb', line 94 def self.factory(vector, **kw) vec = Array(vector) if vec.all? { |item| item.is_a?(Numeric) } NumericStemplot.new(vec, **kw) else StringStemplot.new(vec, **kw) end end |