Class: Doculab::TableOfContents::Section

Inherits:
Object
  • Object
show all
Defined in:
app/models/doculab/table_of_contents.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title) ⇒ Section

Returns a new instance of Section.



30
31
32
33
# File 'app/models/doculab/table_of_contents.rb', line 30

def initialize(title)
  @title = title
  @pages = []
end

Instance Attribute Details

#pagesObject (readonly)

Returns the value of attribute pages.



28
29
30
# File 'app/models/doculab/table_of_contents.rb', line 28

def pages
  @pages
end

#titleObject (readonly)

Returns the value of attribute title.



28
29
30
# File 'app/models/doculab/table_of_contents.rb', line 28

def title
  @title
end

Instance Method Details

#build(block) ⇒ Object



35
36
37
# File 'app/models/doculab/table_of_contents.rb', line 35

def build(block)
  instance_eval(&block)
end

#page(title, options = {}) ⇒ Object



39
40
41
# File 'app/models/doculab/table_of_contents.rb', line 39

def page(title, options = {})
  add_page(Page.new(title, self, options))
end