Class: Spirit::Render::Header
- Defined in:
- lib/spirit/render/templates/header.rb
Overview
Renders a header (e.g. h1
, h2
, …) with anchors.
Instance Attribute Summary collapse
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text, level, name) ⇒ Header
constructor
Creates a new header.
- #render(locals = {}) ⇒ Object
Constructor Details
#initialize(text, level, name) ⇒ Header
Creates a new header.
39 40 41 |
# File 'lib/spirit/render/templates/header.rb', line 39 def initialize(text, level, name) @text, @level, @name = text, level, name end |
Instance Attribute Details
#level ⇒ Object (readonly)
Returns the value of attribute level.
33 34 35 |
# File 'lib/spirit/render/templates/header.rb', line 33 def level @level end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
33 34 35 |
# File 'lib/spirit/render/templates/header.rb', line 33 def name @name end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
33 34 35 |
# File 'lib/spirit/render/templates/header.rb', line 33 def text @text end |
Instance Method Details
#render(locals = {}) ⇒ Object
43 44 45 |
# File 'lib/spirit/render/templates/header.rb', line 43 def render(locals={}) super locals.merge(text: @text, level: @level, name: @name) end |