Sha256: 10e536754bff26fd04d50948a5c414af1832b4f73c3a6661728c721097550cd6

Contents?: true

Size: 662 Bytes

Versions: 1

Compression:

Stored size: 662 Bytes

Contents

require 'daru'

module Daru
  module Plotly
    # exports #plot and #generate_data for DataFrame and Vector
    module Methods
      %i[plot generate_data].each do |method_name|
        define_method method_name do |data, opts|
          if data.is_a? Daru::DataFrame
            Daru::Plotly::DataFrame.send(method_name, data, opts)
          elsif data.is_a? Daru::Vector
            Daru::Plotly::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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
daru-plotly-0.2.0 lib/daru/plotly/methods.rb