Module: Utopia::Controller::Respond::Converter

Defined in:
lib/utopia/controller/respond.rb

Defined Under Namespace

Modules: ToJSON Classes: Callback

Class Method Summary collapse

Class Method Details

.new(*args) ⇒ Object



61
62
63
# File 'lib/utopia/controller/respond.rb', line 61

def self.new(*args)
	Callback.new(*args)
end

.update_response(response, updated_headers) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/utopia/controller/respond.rb', line 33

def self.update_response(response, updated_headers)
	status, headers, body = response
	
	# Generate a new body:
	body = body.collect{|content| yield content}
	
	# Update the headers with the requested content type:
	headers = headers.merge(updated_headers)
	
	return [status, headers, body]
end