Class: Spirit::Render::Header

Inherits:
Template
  • Object
show all
Defined in:
lib/spirit/render/templates/header.rb

Overview

Renders a header (e.g. h1, h2, …) with anchors.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, level, name) ⇒ Header

Creates a new header.

Parameters:

  • text (String)

    header text

  • level (Fixnum)

    1 to 6

  • name (String)

    anchor name



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

#levelObject (readonly)

Returns the value of attribute level.



33
34
35
# File 'lib/spirit/render/templates/header.rb', line 33

def level
  @level
end

#nameObject (readonly)

Returns the value of attribute name.



33
34
35
# File 'lib/spirit/render/templates/header.rb', line 33

def name
  @name
end

#textObject (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