Module: Ric::Html
- Defined in:
- lib/ric/html.rb
Class Method Summary collapse
-
.anything_to_html(son, opts = {}) ⇒ Object
REMOVE ME!.
Instance Method Summary collapse
Class Method Details
.anything_to_html(son, opts = {}) ⇒ Object
REMOVE ME!
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ric/html.rb', line 9 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 |
Instance Method Details
#test ⇒ Object
4 5 6 |
# File 'lib/ric/html.rb', line 4 def test anything_to_html({:note => 'remove me', :foo => :bar } ) end |