Method: Command#to_html

Defined in:
lib/command.rb

#to_htmlObject



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/command.rb', line 195

def to_html
  if self[:exit_code] == 0
  [
  	'<div><table><tr><td width="20"></td><td><pre>',
  	self[:input],
  	'</pre></td></tr></table></div>'
  ].join
  else
  [
  	'<div><table><tr><td width="20"></td><td><pre>',
  	self[:input],
    '</pre><table><tr><td width="20"></td><td><table>',
    map { |k, v| ["<tr><td><strong>#{k}</strong></td>", v.respond_to?(:to_html) ? v.to_html : "<td><span><pre>#{v}</pre></span></td></tr>"] },
    '</table>',
    '</td></tr></table></td></tr></table></div>'
  ].join
  end
end