Sha256: a972807ea4253c9aa70b09f34df9362b674efb062febc840fd001826b72da36c

Contents?: true

Size: 623 Bytes

Versions: 1

Compression:

Stored size: 623 Bytes

Contents

require 'initializer/category'
require 'initializer/dataframe'
require 'initializer/vector'
require 'daru'

module Daru::Plotly::Initializer
  [:plot, :generate_data].each do |method_name|
    define_method method_name do |data, opts|
      if data.is_a? Daru::DataFrame
        Daru::Plotly::Initializer::DataFrame.send(method_name ,data, opts)
      elsif data.is_a? Daru::Vector
        Daru::Plotly::Initializer::Vector.send(method_name, data, opts)
      else
        raise ArgumentError, 'first argument should be Daru::DataFrame or Daru::Vector.'
      end
    end
  end

  module_function :plot, :generate_data
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
daru_plotly-0.1.0 lib/daru_plotly.rb