6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/rails/helpers/rails_helper.rb', line 6
def anything_to_html(son,opts={})
ret = '(RailsHelper :: anything_to_html)' if opts.fetch(:verbose,true) if opts != {}
ret << "(Options: " + anything_to_html(opts) + ")"
end
if son.class == Array
ret << "<ul class='subtopic' >"
son.each{|subtopic|
ret << content_tag(:li, anything_to_html(subtopic).html_safe ) }
ret << "</ul>"
elsif son.class == Hash
ret += '<ul class="maintopic" >'
son.each{ |k,val|
ret << content_tag(:li, ( anything_to_html(k) + ' => ' + anything_to_html(val) ).html_safe )
}
ret << "</ul>"
elsif son.class == String
ret << "<font color='navy' class='ricclass_string' >#{son}</font>"
elsif son.class == Symbol
ret << "<i><font color='gray' class='ricclass_symbol' >:#{son}</font></i>"
else
ret << "(Unknown Class: #{son.class}) <b>#{son}</b>"
end
ret.html_safe
end
|