Class: Rocco::Layout
- Inherits:
-
Mustache
- Object
- Mustache
- Rocco::Layout
- Defined in:
- lib/rocco/layout.rb
Instance Method Summary collapse
-
#initialize(doc) ⇒ Layout
constructor
A new instance of Layout.
- #sections ⇒ Object
- #sources ⇒ Object
- #sources? ⇒ Boolean
- #title ⇒ Object
Constructor Details
#initialize(doc) ⇒ Layout
Returns a new instance of Layout.
6 7 8 |
# File 'lib/rocco/layout.rb', line 6 def initialize(doc) @doc = doc end |
Instance Method Details
#sections ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rocco/layout.rb', line 14 def sections num = 0 @doc.sections.map do |docs,code| { :docs => docs, :code => code, :num => (num += 1) } end end |
#sources ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/rocco/layout.rb', line 29 def sources @doc.sources.sort.map do |source| { :path => source, :basename => File.basename(source), :url => File.basename(source).split('.')[0..-2].join('.') + '.html' } end end |
#sources? ⇒ Boolean
25 26 27 |
# File 'lib/rocco/layout.rb', line 25 def sources? @doc.sources.length > 1 end |
#title ⇒ Object
10 11 12 |
# File 'lib/rocco/layout.rb', line 10 def title File.basename(@doc.file) end |