Class: Coradoc::Element::List::Definition

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

Returns a new instance of Definition.



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

def initialize(items, options = {})
  @items = items
  @delimiter = options.fetch(:delimiter, "::")
  # super(items, options)
end

Instance Attribute Details

#delimiterObject

Returns the value of attribute delimiter.



5
6
7
# File 'lib/coradoc/element/list/definition.rb', line 5

def delimiter
  @delimiter
end

#itemsObject

Returns the value of attribute items.



5
6
7
# File 'lib/coradoc/element/list/definition.rb', line 5

def items
  @items
end

Instance Method Details

#prefixObject



15
16
17
# File 'lib/coradoc/element/list/definition.rb', line 15

def prefix
  @delimiter
end

#to_adocObject



19
20
21
22
23
24
25
# File 'lib/coradoc/element/list/definition.rb', line 19

def to_adoc
  content = "\n"
  @items.each do |item|
    content << item.to_adoc(@delimiter)
  end
  content
end