diff options
Diffstat (limited to 'webapp/sinatra.rb')
-rw-r--r-- | webapp/sinatra.rb | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/webapp/sinatra.rb b/webapp/sinatra.rb deleted file mode 100644 index b61b0a3..0000000 --- a/webapp/sinatra.rb +++ /dev/null @@ -1,47 +0,0 @@ -=begin -* Name: sinatra.rb -* Description: Helper code for sinatra -* Author: Andreas Maunz <andreas@maunz.de> -* Date: 10/2012 -=end - -module OpenTox - class Application < Service - - # Conveniently accessible from anywhere within the Application class, - # it negotiates the appropriate output format based on object class - # and requested MIME type. - # @param [Object] an object - # @return [String] object serialization - def format_output (obj) - - if obj.class == String - - case @accept - when /text\/html/ - content_type "text/html" - obj.to_html - else - content_type 'text/uri-list' - obj - end - - else - - case @accept - when "application/rdf+xml" - content_type "application/rdf+xml" - obj.to_rdfxml - when /text\/html/ - content_type "text/html" - obj.to_html - else - content_type "text/turtle" - obj.to_turtle - end - - end - end - - end -end |