Class: Goliath::Rack::Formatters::YAML
- Inherits:
-
Object
- Object
- Goliath::Rack::Formatters::YAML
- Includes:
- AsyncMiddleware
- Defined in:
- lib/goliath/rack/formatters/yaml.rb
Overview
A YAML formatter.
Instance Method Summary (collapse)
Methods included from AsyncMiddleware
Constructor Details
This class inherits a constructor from Goliath::Rack::AsyncMiddleware
Instance Method Details
- (Object) post_process(env, status, headers, body)
13 14 15 16 17 18 |
# File 'lib/goliath/rack/formatters/yaml.rb', line 13 def post_process(env, status, headers, body) if yaml_response?(headers) body = [body.to_yaml] end [status, headers, body] end |
- (Boolean) yaml_response?(headers)
20 21 22 |
# File 'lib/goliath/rack/formatters/yaml.rb', line 20 def yaml_response?(headers) headers['Content-Type'] =~ %r{^text/yaml} end |