Sha256: 6353e15f58c402fcaa88e28cc684d38a594a857faba64fc10cf4faf71e047f02

Contents?: true

Size: 864 Bytes

Versions: 11

Compression:

Stored size: 864 Bytes

Contents

module Sablon
  module Processor
    class SectionProperties
      def self.from_document(document_xml)
        new document_xml.at_xpath(".//w:sectPr")
      end

      def initialize(properties_node)
        @properties_node = properties_node
      end

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

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

      private
      def find_or_add_pg_num_type
        pg_num_type || begin
                         node = Nokogiri::XML::Node.new "w:pgNumType", @properties_node.document
                         @properties_node.children.after node
                         node
                       end
      end

      def pg_num_type
        @pg_num_type ||= @properties_node.at_xpath(".//w:pgNumType")
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sablon-0.1.1 lib/sablon/processor/section_properties.rb
sablon-0.1.0 lib/sablon/processor/section_properties.rb
sablon-0.0.22 lib/sablon/processor/section_properties.rb
sablon-0.0.21 lib/sablon/processor/section_properties.rb
sablon-0.0.20 lib/sablon/processor/section_properties.rb
sablon-0.0.19 lib/sablon/processor/section_properties.rb
sablon-0.0.19.beta5 lib/sablon/processor/section_properties.rb
sablon-0.0.19.beta4 lib/sablon/processor/section_properties.rb
sablon-0.0.19.beta3 lib/sablon/processor/section_properties.rb
sablon-0.0.19.beta2 lib/sablon/processor/section_properties.rb
sablon-0.0.19.beta1 lib/sablon/processor/section_properties.rb