Class: Elisp::Heading

Inherits:
Object
  • Object
show all
Defined in:
lib/elisp/heading.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contentObject (readonly)

Returns the value of attribute content.



19
20
21
# File 'lib/elisp/heading.rb', line 19

def content
  @content
end

#levelObject (readonly)

Returns the value of attribute level.



19
20
21
# File 'lib/elisp/heading.rb', line 19

def level
  @level
end

Instance Method Details

#htmlObject



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