Class: Coradoc::Element::Term

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/element/term.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(term, options = {}) ⇒ Term

Returns a new instance of Term.



8
9
10
11
12
13
# File 'lib/coradoc/element/term.rb', line 8

def initialize(term, options = {})
  @term = term
  @type = options.fetch(:type, nil)
  @lang = options.fetch(:lang, :en)
  @line_break = options.fetch(:line_break, "")
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

#termObject

Returns the value of attribute term.



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

def term
  @term
end

Instance Method Details

#to_adocObject



15
16
17
18
# File 'lib/coradoc/element/term.rb', line 15

def to_adoc
  return "#{@type}:[#{@term}]#{@line_break}" if @lang == :en
  "[#{@type}]##{@term}##{@line_break}"
end