Class: NetMate::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/net_mate/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ Response

Returns a new instance of Response.



4
5
6
# File 'lib/net_mate/response.rb', line 4

def initialize body
  @body = body
end

Instance Method Details

#errorObject



16
17
18
19
20
21
22
# File 'lib/net_mate/response.rb', line 16

def error
  Rack::Response.new.finish do |res|
    res['Content-Type'] = 'text/html'
    res.status = 404
    res.write @body
  end
end

#respondObject



8
9
10
11
12
13
14
# File 'lib/net_mate/response.rb', line 8

def respond
  Rack::Response.new.finish do |res|
    res['Content-Type'] = 'text/html'
    res.status = 200
    res.write @body
  end
end