Sha256: fc92ef07f602d438a2a72bc9e63254064959e91791a5852c1a7903f8e3ce73f4

Contents?: true

Size: 1.18 KB

Versions: 25

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for parsing Paragraph Spacing in paragraph properties `w:spacing`
  class ParagraphSpacing < OOXMLDocumentObject
    # @return [OoxmlSize] value of before spacing
    attr_accessor :before
    # @return [OoxmlSize] value of after spacing
    attr_accessor :after
    # @return [OoxmlSize] value of line spacing
    attr_accessor :line
    # @return [Symbol] value of line rule style
    attr_accessor :line_rule

    # Parse ParagraphSpacing
    # @param [Nokogiri::XML:Node] node with ParagraphSpacing
    # @return [ParagraphSpacing] result of parsing
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'before'
          @before = OoxmlSize.new(value.value.to_f)
        when 'after'
          @after = OoxmlSize.new(value.value.to_f)
        when 'lineRule'
          @line_rule = value.value.sub('atLeast', 'at_least').to_sym
        when 'line'
          @line = if @line_rule == :auto
                    OoxmlSize.new(value.value.to_f, :one_240th_cm)
                  else
                    OoxmlSize.new(value.value.to_f)
                  end
        end
      end
      self
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
ooxml_parser-0.18.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.18.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.17.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.16.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.15.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.14.2 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.14.1-mingw32 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.14.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.14.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.13.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.12.2 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.12.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.12.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.11.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.10.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.9.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.9.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.8.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.8.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb
ooxml_parser-0.7.2 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb