Module: KUtil::Data::InstanceVariablesToH
- Defined in:
- lib/k_util/data/instance_variables_to_h.rb
Overview
Helper methods attached to the namespace for working with Data
Instance Method Summary collapse
Instance Method Details
#to_h ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/k_util/data/instance_variables_to_h.rb', line 9 def to_h hash = {} instance_variables.each do |var| value = instance_variable_get(var) value = KUtil.data.to_hash(value) if KUtil.data.hash_convertible?(value) hash[var.to_s.delete('@')] = value end hash end |