Class: ODF::Property
- Inherits:
-
Object
- Object
- ODF::Property
- Defined in:
- lib/odf/property.rb
Constant Summary collapse
- PROPERTY_NAMES =
{:cell => 'style:table-cell-properties', :text => 'style:text-properties', :column => 'style:table-column-properties'}
Instance Method Summary collapse
-
#initialize(type, specs = {}) ⇒ Property
constructor
A new instance of Property.
- #xml ⇒ Object
Constructor Details
#initialize(type, specs = {}) ⇒ Property
Returns a new instance of Property.
27 28 29 30 |
# File 'lib/odf/property.rb', line 27 def initialize(type, specs={}) @name = PROPERTY_NAMES[type] @specs = specs.map { |k, v| [k.to_s, v] } end |
Instance Method Details
#xml ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/odf/property.rb', line 32 def xml specs = @specs.inject({}) do |acc, kv| prefix = 'column-width' == kv.first ? 'style' : 'fo' acc.merge prefix + ':' + kv.first => kv.last end Builder::XmlMarkup.new.tag! @name, specs end |