Module: Doculab::TableOfContents
- Defined in:
- app/models/doculab/table_of_contents.rb
Defined Under Namespace
Class Method Summary collapse
- .add_page(page) ⇒ Object
- .define(&block) ⇒ Object
- .lookup(permalink) ⇒ Object
- .section(title, &block) ⇒ Object
Class Method Details
.add_page(page) ⇒ Object
19 20 21 |
# File 'app/models/doculab/table_of_contents.rb', line 19 def self.add_page(page) @@pages << page end |
.define(&block) ⇒ Object
6 7 8 9 10 11 |
# File 'app/models/doculab/table_of_contents.rb', line 6 def self.define(&block) @@sections = [] @@pages = [] self.instance_eval(&block) return self end |
.lookup(permalink) ⇒ Object
23 24 25 |
# File 'app/models/doculab/table_of_contents.rb', line 23 def self.lookup(permalink) pages.detect { |p| p.permalink == permalink } end |
.section(title, &block) ⇒ Object
13 14 15 16 17 |
# File 'app/models/doculab/table_of_contents.rb', line 13 def self.section(title, &block) section = Section.new(title) @@sections << section section.build(block) end |