Class: Rocx::Style

Inherits:
Object
  • Object
show all
Defined in:
lib/rocx/style.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, run = {}, paragraph = {}) ⇒ Style

Returns a new instance of Style.



5
6
7
8
9
10
# File 'lib/rocx/style.rb', line 5

def initialize(name, type, run={}, paragraph={})
  @name = name
  @type = type
  @run = run
  @paragraph = paragraph
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/rocx/style.rb', line 3

def name
  @name
end

#paragraphObject (readonly)

Returns the value of attribute paragraph.



3
4
5
# File 'lib/rocx/style.rb', line 3

def paragraph
  @paragraph
end

#runObject (readonly)

Returns the value of attribute run.



3
4
5
# File 'lib/rocx/style.rb', line 3

def run
  @run
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/rocx/style.rb', line 3

def type
  @type
end

Instance Method Details

#build_xml(xml) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/rocx/style.rb', line 12

def build_xml(xml)
  xml["w"].style("w:styleId" => name, "w:type" => type) {
    xml["w"].name("w:val" => name)
    paragraph_as_xml(xml)
    run_as_xml(xml)
  }
end