Class: ODF::Style
Constant Summary collapse
- FAMILIES =
{:cell => 'table-cell', :column => 'table-column'}
Instance Method Summary collapse
-
#initialize(name = '', opts = {}) ⇒ Style
constructor
A new instance of Style.
- #make_element_attributes(name, opts) ⇒ Object
- #to_s ⇒ Object
- #xml ⇒ Object
Methods inherited from Container
Constructor Details
#initialize(name = '', opts = {}) ⇒ Style
Returns a new instance of Style.
30 31 32 33 |
# File 'lib/odf/style.rb', line 30 def initialize(name='', opts={}) @name = name @elem_attrs = make_element_attributes(@name, opts) end |
Instance Method Details
#make_element_attributes(name, opts) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/odf/style.rb', line 41 def make_element_attributes(name, opts) attrs = {'style:name' => name, 'style:family' => FAMILIES[opts[:family]]} attrs['style:data-style-name'] = opts[:data_style] unless opts[:data_style].nil? attrs['style:parent-style-name'] = opts[:parent].to_s unless opts[:parent].nil? attrs end |
#to_s ⇒ Object
48 49 50 |
# File 'lib/odf/style.rb', line 48 def to_s @name end |
#xml ⇒ Object
35 36 37 38 39 |
# File 'lib/odf/style.rb', line 35 def xml Builder::XmlMarkup.new.style:style, @elem_attrs do |xml| xml << properties_xml end end |