Method: Faker::HTML.table
- Defined in:
- lib/faker/default/html.rb
.table ⇒ String
Produces a random HTML table.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/faker/default/html.rb', line 112 def table header_row = generate_table_row('th', 3) = generate_table_row('td', 3) body_rows = [] 3.times do row = generate_table_row('td', 3) body_rows << row end thead = "<thead>\n#{header_row}</thead>" tbody = "<tbody>\n#{body_rows.join("\n")}</tbody>" tfoot = "<tfoot>\n#{}</tfoot>" "<table>\n#{thead}\n#{tbody}\n#{tfoot}\n</table>" end |