Class: Elisp::Heading
- Inherits:
-
Object
- Object
- Elisp::Heading
- Defined in:
- lib/elisp/heading.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(content, level: 2) ⇒ Heading
constructor
A new instance of Heading.
Constructor Details
#initialize(content, level: 2) ⇒ Heading
Returns a new instance of Heading.
21 22 23 24 |
# File 'lib/elisp/heading.rb', line 21 def initialize(content, level: 2) @content = content @level = level end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
19 20 21 |
# File 'lib/elisp/heading.rb', line 19 def content @content end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
19 20 21 |
# File 'lib/elisp/heading.rb', line 19 def level @level end |
Instance Method Details
#html ⇒ Object
26 27 28 29 30 |
# File 'lib/elisp/heading.rb', line 26 def html name = "h#{@level}" content = CGI.escape_html(@content) "<#{name}>#{content}</#{name}>" end |