Sha256: 5b8f0bd20899703cd5de49ea0e3e07e54a4d219cf14c16557562c1a20ef12153
Contents?: true
Size: 1.11 KB
Versions: 29
Compression:
Stored size: 1.11 KB
Contents
module Ric module Html def test anything_to_html({:note => 'remove me', :foo => :bar } ) end # REMOVE ME! def self.anything_to_html(son,opts={}) ret = '(Ric::Html.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 #/Html end #/Ric
Version data entries
29 entries across 29 versions & 1 rubygems