lib/inout.rb
# The entry point for rendering any ruote-rest object
#
# (pronounce with a "rolling r")
#
The entry point for rendering any ruote-rest object
(pronounce with a "rolling r")
The entry point for rendering any ruote - rest object ( pronounce with a " rolling r " )
def rrender (type, object, options={})
    format, ctype = determine_out_format(options)
    ctype = 'text/plain' if params[:plain]
    response.status = options.delete(:status) || 200
    response.content_type = ctype
    options.each { |k, v| response.header[k] = v }
    set_etag(object.etag) \
      if object.respond_to?(:etag) and object.etag
    set_last_modified(object.timestamp) \
      if object.respond_to?(:timestamp) and object.timestamp
         where the conditional GET happens...
    unless format == 'js'
      body = send("render_{type}_{format}", object)
      body = body.gsub(', ', ",\n ") \
        if format == 'json' and ctype == 'text/plain'
           a bit more readable for 'text/plain' output
      return body
    end
    varname = params[:var] || 'ruote_js'
    method = "render_{type}_json"
    "var {varname} = {send(method, object)}"
  end
def rrender ( type , object , options = { } ) format , ctype = determine_out_format ( options ) ctype = 'text/plain' if params [ :plain ] response . status = options . delete ( :status ) || 200 response . content_type = ctype options . each { | k , v | response . header [ k ] = v } set_etag ( object . etag ) if object . respond_to? ( :etag ) and object . etag set_last_modified ( object . timestamp ) if object . respond_to? ( :timestamp ) and object . timestamp unless format == 'js' body = send ( "render_#{type}_#{format}" , object ) body = body . gsub ( ', ' , ",\n " ) if format == 'json' and ctype == 'text/plain' return body end varname = params [ :var ] || 'ruote_js' method = "render_#{type}_json" "var #{varname} = #{send(method, object)}" end
The entry point for rendering any ruote-rest object
(pronounce with a "rolling r")
The entry point for rendering any ruote - rest object ( pronounce with a " rolling r " )
# useful for debugging # # where the conditional GET happens... # a bit more readable for 'text/plain' output
type
<not_specific>
object
<not_specific>
options
<not_specific>