Module: InstVarsToHash

Instance Method Summary collapse

Instance Method Details

#to_hObject



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

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

#to_sObject



3
4
5
# File 'lib/academic_benchmarks/lib/inst_vars_to_hash.rb', line 3

def to_s
  to_h.to_s
end