Module: Pact::MockService::RequestHandlers::PrettyGenerate

Included in:
HandleMatchedInteraction, HandleMultipleInteractionsFound, HandleMultipleInteractionsFoundForStub, InteractionReplay
Defined in:
lib/pact/mock_service/request_handlers/interaction_replay.rb

Instance Method Summary collapse

Instance Method Details

#pretty_generate(object) ⇒ Object

Doesn’t seem to reliably pretty generate unless we go to JSON and back again :(



15
16
17
18
19
20
21
# File 'lib/pact/mock_service/request_handlers/interaction_replay.rb', line 15

def pretty_generate object
  begin
    JSON.pretty_generate(JSON.parse(object.to_json))
  rescue
    object.to_s
  end
end