Sha256: bbc8bb633f771d08c2e205dd39c62af5042f3e4150f7f0ba9a8c6fb5495afac5

Contents?: true

Size: 863 Bytes

Versions: 18

Compression:

Stored size: 863 Bytes

Contents

module Sablon
  class 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

18 entries across 18 versions & 1 rubygems

Version Path
sablon-0.0.18 lib/sablon/processor/section_properties.rb
sablon-0.0.17 lib/sablon/processor/section_properties.rb
sablon-0.0.16 lib/sablon/processor/section_properties.rb
sablon-0.0.15 lib/sablon/processor/section_properties.rb
sablon-0.0.14 lib/sablon/processor/section_properties.rb
sablon-0.0.13 lib/sablon/processor/section_properties.rb
sablon-0.0.12 lib/sablon/processor/section_properties.rb
sablon-0.0.11 lib/sablon/processor/section_properties.rb
sablon-0.0.10 lib/sablon/processor/section_properties.rb
sablon-0.0.9 lib/sablon/processor/section_properties.rb
sablon-0.0.8 lib/sablon/processor/section_properties.rb
sablon-0.0.7 lib/sablon/processor/section_properties.rb
sablon-0.0.6 lib/sablon/processor/section_properties.rb
sablon-0.0.5 lib/sablon/processor/section_properties.rb
sablon-0.0.4 lib/sablon/processor/section_properties.rb
sablon-0.0.3 lib/sablon/processor/section_properties.rb
sablon-0.0.2 lib/sablon/processor/section_properties.rb
sablon-0.0.1 lib/sablon/processor/section_properties.rb