Class: ListOf

Inherits:
Object
  • Object
show all
Defined in:
lib/coursegen/course/helpers/list_of.rb

Overview

Class ListOf represents a lecture table.

Instance Method Summary collapse

Constructor Details

#initialize(markup_adaptor, data_adaptor, rows, cols, subsections, items, headers) ⇒ ListOf

Initialize creates an instance of ListOf.

source: name of a section as a string rows: array with one or more of:

"pages"
"subsections"

subsections: array with one or more strings corresponding to subsection

string in an item
e.g. "/content/topics/arch/"

cols: array with one or more of:

:date
:number
:title
:homeworks
:lectref
:readings

items: refers to nanoc’s @items (temp hack!)



20
21
22
23
24
25
26
27
28
# File 'lib/coursegen/course/helpers/list_of.rb', line 20

def initialize(markup_adaptor, data_adaptor, rows, cols, subsections, items, headers)
  @mark = markup_adaptor
  @rows = rows
  @cols = cols
  @data = data_adaptor
  @subsections = subsections
  @items = items
  @headers = headers
end

Instance Method Details

#renderObject

Render renders the underlying lecture table.



31
32
33
34
35
36
37
# File 'lib/coursegen/course/helpers/list_of.rb', line 31

def render
  @mark.table_begin("table-striped table-sm table-responsive table-hover")
  generate_headers
  generate_rows
  @mark.table_end
  @mark.render
end