Class: EqJsonDebugDumper

Inherits:
Object
  • Object
show all
Defined in:
lib/debug_dumper.rb

Instance Method Summary collapse

Constructor Details

#initialize(matcher) ⇒ EqJsonDebugDumper

Returns a new instance of EqJsonDebugDumper.



5
6
7
# File 'lib/debug_dumper.rb', line 5

def initialize(matcher)
  @matcher = matcher
end

Instance Method Details

#dumpObject



9
10
11
12
13
14
# File 'lib/debug_dumper.rb', line 9

def dump
  dumpToFile('expected', @matcher.expected)
  dumpToFile('actual', @matcher.actual)
  dumpToFile('currentExpectedObj', @matcher.currentExpectedObj)
  dumpToFile('currentActualObj', @matcher.currentActualObj)
end

#dumpToFile(baseName, jsonHash) ⇒ Object



16
17
18
19
20
21
# File 'lib/debug_dumper.rb', line 16

def dumpToFile(baseName, jsonHash)
  fileName = Dir.tmpdir() + File::SEPARATOR + "#{baseName}.json"
  File.open(fileName, "w") do |file|
    file.print JSON.pretty_generate(jsonHash)
  end
end