Sha256: 2087e7e60e80a020967f40863cd152195c51e75953657931d8c542be8bd9b8a9
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
# WebROaR - Ruby Application Server - http://webroar.in/ # Copyright (C) 2009 Goonj LLC # # This file is part of WebROaR. # # WebROaR is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # WebROaR is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with WebROaR. If not, see <http://www.gnu.org/licenses/>. module Webroar class Utils class << self def calculate_content_length(body) case body when String # See http://redmine.ruby-lang.org/issues/show/203 (body.respond_to?(:bytesize) ? body.bytesize : body.size).to_s when Array bytes = 0 body.each do |p| bytes += p.respond_to?(:bytesize) ? p.bytesize : p.size end bytes.to_s end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
webroar-0.2.5 | src/ruby_lib/ruby_interface/utils.rb |
webroar-0.2.4 | src/ruby_lib/ruby_interface/utils.rb |
webroar-0.2.3 | src/ruby_lib/ruby_interface/utils.rb |