Module: InstVarsToHash

Defined in:
lib/pygmy/inst_vars_to_hash.rb

Instance Method Summary collapse

Instance Method Details

#to_hObject



6
7
8
9
10
11
12
# File 'lib/pygmy/inst_vars_to_hash.rb', line 6

def to_h
  retval = {}
  instance_variables.each do |iv|
    retval[iv.to_s.delete('@').to_sym] = elem_to_h(instance_variable_get(iv))
  end
  retval
end

#to_sObject



2
3
4
# File 'lib/pygmy/inst_vars_to_hash.rb', line 2

def to_s
  to_h.to_s
end