Module: HttpStub::Server::Application::TextFormattingSupport

Defined in:
lib/http_stub/server/application/text_formatting_support.rb

Instance Method Summary collapse

Instance Method Details

#h(text) ⇒ Object



7
8
9
# File 'lib/http_stub/server/application/text_formatting_support.rb', line 7

def h(text)
  Rack::Utils.escape_html(text)
end

#pp(text) ⇒ Object



11
12
13
14
15
# File 'lib/http_stub/server/application/text_formatting_support.rb', line 11

def pp(text)
  text ? JSON.pretty_generate(JSON.parse(text)) : ""
rescue JSON::ParserError
  text
end