Module: DIFECTS::FailureDetails::VariablesListing

Defined in:
lib/difects.rb

Instance Method Summary collapse

Instance Method Details

#to_yaml(options = {}) ⇒ Object



1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
# File 'lib/difects.rb', line 1089

def to_yaml options = {}
  require 'pp'
  require 'stringio'

  inject(Hash.new) do |hash, (variable, value)|
    pretty = PP.pp(value, StringIO.new).string.chomp
    hash[variable] = "(#{value.class}) #{pretty}"
    hash
  end.to_yaml(options)
end