Class: RODF::ParagraphContainer

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

Overview

Container for all kinds of paragraph content

Direct Known Subclasses

Hyperlink, Paragraph, Span

Instance Method Summary collapse

Methods inherited from Container

create, #initialize

Constructor Details

This class inherits a constructor from RODF::Container

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(style, *args) ⇒ Object



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

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

Instance Method Details

#<<(content) ⇒ Object



22
23
24
# File 'lib/rodf/paragraph_container.rb', line 22

def <<(content)
  span(content)
end

#content_partsObject



4
5
6
# File 'lib/rodf/paragraph_container.rb', line 4

def content_parts
  @content_parts ||= []
end

#content_parts_xmlObject



8
9
10
# File 'lib/rodf/paragraph_container.rb', line 8

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

Yields:

  • (l)


22
23
24
25
26
27
28
29
30
# File 'lib/rodf/hyperlink.rb', line 22

def link(*args)
  l = Hyperlink.new(*args)

  yield l if block_given?

  content_parts << l

  l
end

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

Yields:

  • (s)


12
13
14
15
16
17
18
19
20
# File 'lib/rodf/paragraph_container.rb', line 12

def span(*args)
  s = Span.new(*args)

  yield s if block_given?

  content_parts << s

  s
end

#tab(*args) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/rodf/tab.rb', line 9

def tab(*args)
  t = Tab.new

  content_parts << t

  t
end