Module: Detest::FailureDetails::VariablesListing

Defined in:
lib/detest.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) to_yaml(options = {})



1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
# File 'lib/detest.rb', line 1131

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