Class: ODF::ParagraphContainer

Inherits:
Container show all
Defined in:
lib/odf/paragraph_container.rb,
lib/odf/tab.rb,
lib/odf/span.rb,
lib/odf/hyperlink.rb

Overview

Container for all kinds of paragraph content

Direct Known Subclasses

Hyperlink, Paragraph, Span

Instance Method Summary collapse

Methods inherited from Container

contains, create

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(style, *args) ⇒ Object



65
66
67
# File 'lib/odf/span.rb', line 65

def method_missing(style, *args)
  span(style, *args)
end

Instance Method Details

#<<(content) ⇒ Object



61
62
63
# File 'lib/odf/span.rb', line 61

def <<(content)
  span(content)
end

#content_partsObject



26
27
28
# File 'lib/odf/paragraph_container.rb', line 26

def content_parts
  @content_parts ||= []
end

#content_parts_xmlObject



30
31
32
# File 'lib/odf/paragraph_container.rb', line 30

def content_parts_xml
  content_parts.map {|p| p.xml}.join
end

Yields:

  • (l)


42
43
44
45
46
47
# File 'lib/odf/hyperlink.rb', line 42

def link(*args)
  l = Hyperlink.new(*args)
  yield l if block_given?
  content_parts << l
  l
end

#span(*args) {|s| ... } ⇒ Object

Yields:

  • (s)


54
55
56
57
58
59
# File 'lib/odf/span.rb', line 54

def span(*args)
  s = Span.new(*args)
  yield s if block_given?
  content_parts << s
  s
end

#tab(*args) ⇒ Object



31
32
33
34
35
# File 'lib/odf/tab.rb', line 31

def tab(*args)
  t = Tab.new
  content_parts << t
  t
end