Class: RODF::PageLayout
Instance Method Summary collapse
- #add_properties(*elements) ⇒ Object
-
#initialize(name) ⇒ PageLayout
constructor
A new instance of PageLayout.
- #properties ⇒ Object
- #properties_xml ⇒ Object
- #property(*args, &block) ⇒ Object
- #xml ⇒ Object
Methods inherited from Container
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 |
#properties ⇒ Object
9 10 11 |
# File 'lib/rodf/page_layout.rb', line 9 def properties @properties ||= [] end |
#properties_xml ⇒ Object
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 |
#xml ⇒ Object
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 |