Module: Plotly::Castable

Included in:
Axis, Data, Layout, Line, Marker
Defined in:
lib/plotly/castable.rb

Instance Method Summary collapse

Instance Method Details

#to_hObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/plotly/castable.rb', line 3

def to_h
  instance_variables.map do |attribute|
    k = attribute.to_s.delete('@').to_sym
    v = instance_variable_get(attribute)

    v = v.to_h if in_plotly_module?(v.class)

    [k, v]
  end.to_h
end