summaryrefslogtreecommitdiff
path: root/lib/overwrite.rb
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2013-06-05 16:37:25 +0200
committergebele <gebele@in-silico.ch>2013-06-05 16:37:25 +0200
commit5dab9d972bedb4319de39ee17253902fb37f8667 (patch)
treedf63afa049f5ddf9873fe0e658a91859db490255 /lib/overwrite.rb
parent0c20a7e7841c2c85a4d3260d018017d350bc0953 (diff)
parent962773d59d94f8d16dae11b6290fdf30aaf09d7b (diff)
Merge branch 'development' of github.com:opentox/opentox-client into development
Diffstat (limited to 'lib/overwrite.rb')
-rw-r--r--lib/overwrite.rb21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/overwrite.rb b/lib/overwrite.rb
index 1579469..fbe8f7d 100644
--- a/lib/overwrite.rb
+++ b/lib/overwrite.rb
@@ -38,19 +38,18 @@ class String
# format of text (=string params) is preserved (e.g. line breaks)
# urls are marked as links
#
- # @param [String] text this is the actual content,
- # @param [optional,String] related_links info on related resources
- # @param [optional,String] description general info
- # @param [optional,Array] post_command, infos for the post operation, object defined below
+ # @param related_links [optional,String] uri on related resources
+ # @param description [optional,String] general info
+ # @param png_image [optional,String] imagename
# @return [String] html page
def to_html(related_links=nil, description=nil, png_image=nil )
-
+
# TODO add title as parameter
title = nil #$sinatra.to($sinatra.request.env['PATH_INFO'], :full) if $sinatra
html = "<html>"
html << "<title>"+title+"</title>" if title
#html += "<img src=\""+OT_LOGO+"\"><\/img><body>"
-
+
html << "<h3>Description</h3><pre><p>"+description.link_urls+"</p></pre>" if description
html << "<h3>Related links</h3><pre><p>"+related_links.link_urls+"</p></pre>" if related_links
html << "<h3>Content</h3>" if description || related_links
@@ -60,7 +59,7 @@ class String
html << "</p></pre></body></html>"
html
end
-
+
def uri?
URI.valid?(self)
end
@@ -76,7 +75,7 @@ module URI
def self.task? uri
uri =~ /task/ and URI.valid? uri
end
-
+
def self.dataset? uri, subjectid=nil
uri =~ /dataset/ and URI.accessible? uri, subjectid=nil
end
@@ -119,7 +118,7 @@ end
class File
# @return [String] mime_type including charset using linux cmd command
- def mime_type
+ def mime_type
`file -ib #{self.path}`.chomp
end
end
@@ -138,12 +137,12 @@ module Kernel
internal_server_error "`" + cmd + "` failed.\n" + stdout + stderr unless status.success?
return stdout
rescue
- internal_server_error $!.message
+ internal_server_error $!.message
end
# @return [String] uri of task result, if task fails, an error according to task is raised
def wait_for_task uri
- if URI.task?(uri)
+ if URI.task?(uri)
t = OpenTox::Task.new uri
t.wait
unless t.completed?