Class: Sinatra::Response

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

Instance Method Summary collapse

Instance Method Details

#send(status = 200) ⇒ Object



17
18
19
20
# File 'lib/helpers.rb', line 17

def send(status=200)
  set_content_length!
  [status, self.headers, self.body]
end

#set_content_length!Object



12
13
14
15
# File 'lib/helpers.rb', line 12

def set_content_length!
  self["Content-Length"] =
    self.body.inject(0) {|a, l| a += l.length}
end