module Rails::Helpers::RailsHelper

Public Instance Methods

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