class TableMaker
Constants
- Divider
- TermWidth
- Underline
Public Instance Methods
caption(str)
click to toggle source
# File exe/mlb-standings, line 27 def caption(str) puts Divider, str end
row(tr)
click to toggle source
# File exe/mlb-standings, line 41 def row(tr) columns = tr.element_children.map { |td| td.text } columns = columns.map { |column| column.rjust(8, ' ') } if abbr = tr.first_element_child.at_css("abbr") columns[0] = abbr.text.rjust(8, ' ') end columns = columns.take((TermWidth - 15) / 8) puts columns.join end
td(tr)
click to toggle source
# File exe/mlb-standings, line 37 def td(tr) row(tr) end
th(tr)
click to toggle source
# File exe/mlb-standings, line 31 def th(tr) puts Underline row(tr) puts Underline end