Class: RODF::DataStyle
Instance Method Summary
collapse
Methods inherited from Container
create
Constructor Details
#initialize(name, type) ⇒ DataStyle
Returns a new instance of DataStyle.
3
4
5
6
7
|
# File 'lib/rodf/data_style.rb', line 3
def initialize(name, type)
super
@type, @name = type, name
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
42
43
44
|
# File 'lib/rodf/data_style.rb', line 42
def method_missing(name, *args)
section(name, *args)
end
|
Instance Method Details
#add_style_sections(*elements) ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/rodf/data_style.rb', line 26
def add_style_sections(*elements)
if elements.first.is_a?(Array)
elements = elements.first
end
elements.each do |element|
style_section(element)
end
end
|
#style_section(*args, &block) ⇒ Object
Also known as:
section
13
14
15
16
17
18
19
|
# File 'lib/rodf/data_style.rb', line 13
def style_section(*args, &block)
x = StyleSection.new(*args, &block)
style_sections << x
return x
end
|
#style_sections ⇒ Object
9
10
11
|
# File 'lib/rodf/data_style.rb', line 9
def style_sections
@style_sections ||= []
end
|
#style_sections_xml ⇒ Object
22
23
24
|
# File 'lib/rodf/data_style.rb', line 22
def style_sections_xml
style_sections.map(&:xml).join
end
|
#xml ⇒ Object
36
37
38
39
40
|
# File 'lib/rodf/data_style.rb', line 36
def xml
Builder::XmlMarkup.new.tag! "number:#{@type}-style", 'style:name' => @name do |xml|
xml << style_sections_xml
end
end
|