class Roda::RodaPlugins::SinatraHelpers::DelayedBody
write to it.
of using Roda’s default body array and response.write to
Class used when the response body is set explicitly, instead
def each
If the body is a String, yield it, otherwise yield each string
def each v = value if v.is_a?(String) yield v else v.each{|s| yield s} end end
def empty?
Assume that if the body has been set directly that it is
def empty? false end
def initialize(&block)
Save the block that will return the body, it won't be
def initialize(&block) @block = block end
def join
def join a = [] each{|s| a << s} a.join end
def length
def length length = 0 each{|s| length += s.bytesize} length end
def value
Cache the body returned by the block. This way the block won't
def value @value ||= @block.call end