module Mojito::Rendering::Content

Public Instance Methods

render_as(type, content, *args) click to toggle source
# File lib/mojito/rendering/content.rb, line 11
def render_as(type, content, *args)
        renderer = "to_#{type}".to_sym
        if content.respond_to? renderer
                response.write(content.send(renderer, *args[0...content.method(renderer).arity]))
        else
                Mojito::Rendering::StatusCodes.instance_method(:not_found!).bind(self).call
        end
end
write(content) click to toggle source
# File lib/mojito/rendering/content.rb, line 7
def write(content)
        response.write content
end