Class: Spirit::Render::Processors::HeadersProcessor
- Defined in:
- lib/spirit/render/processors/headers_processor.rb
Overview
In-charge of headers, navigation bar, and nesting. Depends on renderer#navigation and renderer#nesting
Instance Method Summary collapse
-
#header(text, level) ⇒ String
Increases all header levels by one and keeps a navigation bar.
-
#initialize(renderer, *args) ⇒ HeadersProcessor
constructor
A new instance of HeadersProcessor.
Methods inherited from Base
events, inherited, #invoke_callbacks_for, process
Constructor Details
#initialize(renderer, *args) ⇒ HeadersProcessor
Returns a new instance of HeadersProcessor.
11 12 13 14 15 |
# File 'lib/spirit/render/processors/headers_processor.rb', line 11 def initialize(renderer, *args) renderer.nesting = @nesting = [] renderer. = @navigation = Navigation.new @headers = Headers.new end |
Instance Method Details
#header(text, level) ⇒ String
Increases all header levels by one and keeps a navigation bar.
19 20 21 22 23 24 |
# File 'lib/spirit/render/processors/headers_processor.rb', line 19 def header(text, level) h = headers.add(text, level += 1) .append(text, h.name) if level == 2 nest h h.render end |