Class: AsciiDoc::AsciiElement

Inherits:
Object
  • Object
show all
Defined in:
lib/asciidoc/asciielement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ AsciiElement

Returns a new instance of AsciiElement.



7
8
9
10
# File 'lib/asciidoc/asciielement.rb', line 7

def initialize(type)
  @type = type
  @children = []
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



5
6
7
# File 'lib/asciidoc/asciielement.rb', line 5

def children
  @children
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/asciidoc/asciielement.rb', line 5

def type
  @type
end

Instance Method Details

#attributesObject

AsciiDoc Attributes




33
34
35
# File 'lib/asciidoc/asciielement.rb', line 33

def attributes
  @attributes
end

#attributes=(att) ⇒ Object



37
38
39
# File 'lib/asciidoc/asciielement.rb', line 37

def attributes=(att)
  @attributes = att
end

#render(views) ⇒ Object

Raises:

  • (Exception)


12
13
14
15
16
# File 'lib/asciidoc/asciielement.rb', line 12

def render(views)
  element = self
  raise Exception, "Template file doesn't exist: #{@type}" if views[@type].nil?
  views[@type].result(binding)
end

#standard_render(views) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/asciidoc/asciielement.rb', line 18

def standard_render(views)
  content = ""
  @children.each do |child|
    if(child.is_a? String)
      content += child
    else
      content += child.render(views)
    end
  end
  content
end