class Rack::LDP::Responses

Converts RDF::LDP::Resource} into appropriate responses

Public Class Methods

new(app) click to toggle source

@param [#call] app

# File lib/rack/ldp.rb, line 66
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source

Converts the response body from {RDF::LDP::Resource} form to a Graph

# File lib/rack/ldp.rb, line 72
def call(env)
  status, headers, response = @app.call(env)

  if response.is_a? RDF::LDP::Resource
    new_response = response.to_response
    response.close if response.respond_to? :close
    response = new_response
  end

  [status, headers, response]
end