Class: ODF::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/odf/property.rb

Constant Summary collapse

PROPERTY_NAMES =
{:cell => 'style:table-cell-properties',
:text => 'style:text-properties'}

Instance Method Summary collapse

Constructor Details

#initialize(type, specs = {}) ⇒ Property

Returns a new instance of Property.



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

def initialize(type, specs={})
  @name = PROPERTY_NAMES[type]
  @specs = specs.map { |k, v| [k.to_s, v] }
end

Instance Method Details

#xmlObject



31
32
33
34
35
36
37
# File 'lib/odf/property.rb', line 31

def xml
  specs = {}
  @specs.each do |k, v|
    specs['fo:' + k] = v
  end
  Builder::XmlMarkup.new.tag! @name, specs
end