Class: JsonKeyTransformerMiddleware::OutgoingJsonFormatter

Inherits:
Middleware
  • Object
show all
Defined in:
lib/json_key_transformer_middleware/outgoing_json_formatter.rb

Instance Method Summary collapse

Methods inherited from Middleware

#camel_to_underscore, #deep_transform_hash_keys, #underscore_to_camel

Constructor Details

#initialize(app) ⇒ OutgoingJsonFormatter

Returns a new instance of OutgoingJsonFormatter.



7
8
9
# File 'lib/json_key_transformer_middleware/outgoing_json_formatter.rb', line 7

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/json_key_transformer_middleware/outgoing_json_formatter.rb', line 11

def call(env)
  status, headers, body = @app.call(env)

  new_body = build_new_body(body)

  [status, headers, new_body]
end