Class: RODF::Style
Constant Summary
collapse
- FAMILIES =
{cell: 'table-cell', column: 'table-column', row: 'table-row'}
Instance Method Summary
collapse
Methods inherited from Container
contains, create
Constructor Details
#initialize(name = '', opts = {}, node_tag = 'style:style') ⇒ Style
Returns a new instance of Style.
29
30
31
32
|
# File 'lib/rodf/style.rb', line 29
def initialize(name='', opts={}, node_tag='style:style')
@name, @node_tag = name, node_tag
@elem_attrs = make_element_attributes(@name, opts)
end
|
Instance Method Details
#make_element_attributes(name, opts) ⇒ Object
40
41
42
43
44
45
46
47
48
|
# File 'lib/rodf/style.rb', line 40
def make_element_attributes(name, opts)
attrs = {
'style:name' => name,
'style:family' => (FAMILIES[opts[:family]] || 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['style:master-page-name'] = opts[:master_page] unless opts[:master_page].nil?
attrs
end
|
#to_s ⇒ Object
50
51
52
|
# File 'lib/rodf/style.rb', line 50
def to_s
@name
end
|
#xml ⇒ Object
34
35
36
37
38
|
# File 'lib/rodf/style.rb', line 34
def xml
Builder::XmlMarkup.new.tag!(@node_tag, @elem_attrs) do |xml|
xml << properties_xml
end
end
|