Class: Rack::LDP::Responses

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/ldp.rb

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Responses

Returns a new instance of Responses.

Parameters:



66
67
68
# File 'lib/rack/ldp.rb', line 66

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object

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



72
73
74
75
76
77
78
79
80
81
82
# 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