module Plotly::Castable
Public Instance Methods
to_h()
click to toggle source
# 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
Private Instance Methods
in_plotly_module?(klazz)
click to toggle source
# File lib/plotly/castable.rb, line 16 def in_plotly_module?(klazz) klazz.to_s.split('::').first == 'Plotly' end