Class: Coradoc::Element::Inline::Highlight

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/element/inline/highlight.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, unconstrained: true) ⇒ Highlight

Returns a new instance of Highlight.



9
10
11
12
# File 'lib/coradoc/element/inline/highlight.rb', line 9

def initialize(content, unconstrained: true)
  @content = content
  @unconstrained = unconstrained
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



5
6
7
# File 'lib/coradoc/element/inline/highlight.rb', line 5

def content
  @content
end

#unconstrainedObject

Returns the value of attribute unconstrained.



5
6
7
# File 'lib/coradoc/element/inline/highlight.rb', line 5

def unconstrained
  @unconstrained
end

Instance Method Details

#to_adocObject



14
15
16
17
18
19
20
21
# File 'lib/coradoc/element/inline/highlight.rb', line 14

def to_adoc
  content = Coradoc::Generator.gen_adoc(@content)
  if @unconstrained
    "###{content}##"
  else
    "##{content}#"
  end
end