Sha256: 12860fc3b9e76cbf6f3ca51cbf11eec470dbf6d985f4fa8ea0efd2a653c5ad3e
Contents?: true
Size: 1.16 KB
Versions: 30
Compression:
Stored size: 1.16 KB
Contents
module Rails module Helpers module RailsHelper def anything_to_html(son,opts={}) ret = '(RailsHelper :: anything_to_html)' if opts.fetch(:verbose,true) # TODO change dflt to false 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 << hash_to_html(son) 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 end #/RailsHelper end end
Version data entries
30 entries across 30 versions & 1 rubygems