Class: Coradoc::Element::Admonition

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/element/admonition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#children_accessors, children_accessors, declare_children, #simplify_block_content, visit, #visit

Constructor Details

#initialize(content, type, options = {}) ⇒ Admonition

Returns a new instance of Admonition.



6
7
8
9
10
# File 'lib/coradoc/element/admonition.rb', line 6

def initialize(content, type, options = {})
  @content = content
  @type = type.downcase.to_sym
  @line_break = options.fetch(:line_break, "")
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



4
5
6
# File 'lib/coradoc/element/admonition.rb', line 4

def content
  @content
end

#line_breakObject

Returns the value of attribute line_break.



4
5
6
# File 'lib/coradoc/element/admonition.rb', line 4

def line_break
  @line_break
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/coradoc/element/admonition.rb', line 4

def type
  @type
end

Instance Method Details

#to_adocObject



12
13
14
15
# File 'lib/coradoc/element/admonition.rb', line 12

def to_adoc
  content = Coradoc::Generator.gen_adoc(@content)
  "#{type.to_s.upcase}: #{content}#{@line_break}"
end