class TableFu::Formatting

Public Class Methods

bar(percent) click to toggle source

In order to show a sideways bar chart, we're extending the builtin TableFu formatters.

# File lib/table_setter/table.rb, line 221
def bar(percent)
  percent = percent.to_f
  if percent < 1
    percent = percent * 100
  end
  "<div class=\"bar\" style=\"width:#{percent}%\">#{percent}%</div>"
end
join(*args) click to toggle source

join multiple columns, with optional delimiter

# File lib/table_setter/table.rb, line 254
def join(*args)
  args.join(" ")
end
joinbr(*args) click to toggle source
# File lib/table_setter/table.rb, line 258
def joinbr(*args)
  args.join("<br>")
end
joincomma(*args) click to toggle source
# File lib/table_setter/table.rb, line 262
def joincomma(*args)
  args.join(", ")
end
markdown(cell) click to toggle source

markdown formatting in tablefu cells

# File lib/table_setter/table.rb, line 229
def markdown(cell)
  RDiscount.new(cell).to_html
end
small(cell) click to toggle source

make it small

# File lib/table_setter/table.rb, line 249
def small(cell)
  "<small>#{cell}</small>"
end
strong(cell) click to toggle source

make it strong

# File lib/table_setter/table.rb, line 244
def strong(cell)
  "<strong>#{cell}</strong>"
end