Class: RODF::PageLayout

Inherits:
Container show all
Defined in:
lib/rodf/page_layout.rb

Instance Method Summary collapse

Methods inherited from Container

create

Constructor Details

#initialize(name) ⇒ PageLayout

Returns a new instance of PageLayout.



3
4
5
6
7
# File 'lib/rodf/page_layout.rb', line 3

def initialize(name)
  super

  @name = name
end

Instance Method Details

#add_properties(*elements) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/rodf/page_layout.rb', line 25

def add_properties(*elements)
  if elements.first.is_a?(Array)
    elements = elements.first
  end

  elements.each do |element|
    property(element)
  end
end

#propertiesObject



9
10
11
# File 'lib/rodf/page_layout.rb', line 9

def properties
  @properties ||= []
end

#properties_xmlObject



21
22
23
# File 'lib/rodf/page_layout.rb', line 21

def properties_xml
  properties.map(&:xml).join
end

#property(*args, &block) ⇒ Object



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

def property(*args, &block)
  x = Property.new(*args, &block)

  properties << x

  return x
end

#xmlObject



35
36
37
38
39
# File 'lib/rodf/page_layout.rb', line 35

def xml
  Builder::XmlMarkup.new.tag! 'style:page-layout', 'style:name' => @name do |b|
    b << properties_xml
  end
end