Class: Derketo::Middleware

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



6
7
8
# File 'lib/derketo/middleware.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/derketo/middleware.rb', line 10

def call(env)
  tracer = Derketo::Tracer.new(ENV['DERKETO_ROOT'])
  response = tracer.trace(@app.call(env))
  serializaton = Derketo::Serializers::Mermaid.new(tracer).serialize
  Derketo::Helpers.write('./tmp/derketo.mmd', serialization)
  response
end