class Bookify::Node::Table

Public Instance Methods

render() click to toggle source
# File lib/bookify/node/table.rb, line 5
def render
  font :primary

  options = {
    header: true,
    width: bounds.width,
    row_colors: ["FFFFFF", "EEEEEE"]
  }

  table table_data, options do
    cells.borders = []

    row(0).borders = [:bottom]
    row(0).border_bottom_width = 0.5
    row(0).font_style = :bold

    cells.padding = 5
  end

  move_down 15
end
table_data() click to toggle source
# File lib/bookify/node/table.rb, line 27
def table_data
  node.css("tr").map do |tr|
    tr.css("th, td").map do |td|
      decode_html(td.inner_html.strip)
    end
  end
end