Class: Sablon::Processor::SectionProperties

Inherits:
Object
  • Object
show all
Defined in:
lib/sablon/processor/section_properties.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml_node) ⇒ SectionProperties

Returns a new instance of SectionProperties.



9
10
11
# File 'lib/sablon/processor/section_properties.rb', line 9

def initialize(xml_node)
  @properties_node = xml_node.at_xpath(".//w:sectPr")
end

Class Method Details

.process(xml_node, env) ⇒ Object



4
5
6
7
# File 'lib/sablon/processor/section_properties.rb', line 4

def self.process(xml_node, env)
  processor = new(xml_node)
  processor.write_properties(env.section_properties)
end

Instance Method Details

#start_page_numberObject



18
19
20
# File 'lib/sablon/processor/section_properties.rb', line 18

def start_page_number
  pg_num_type && pg_num_type["w:start"]
end

#start_page_number=(number) ⇒ Object



22
23
24
# File 'lib/sablon/processor/section_properties.rb', line 22

def start_page_number=(number)
  find_or_add_pg_num_type["w:start"] = number
end

#write_properties(properties = {}) ⇒ Object



13
14
15
16
# File 'lib/sablon/processor/section_properties.rb', line 13

def write_properties(properties = {})
  return unless properties["start_page_number"]
  self.start_page_number = properties["start_page_number"]
end