Sha256: bc230f015c9b48d7a42f70637d61221dc24bdac131cd993c26c53d21fc4f0fc4

Contents?: true

Size: 758 Bytes

Versions: 1

Compression:

Stored size: 758 Bytes

Contents

require_relative 'paragraph_run/run_properties'
module OoxmlParser
  # Class for parsing `r` tags
  class ParagraphRun < OOXMLDocumentObject
    attr_accessor :properties, :text

    def initialize(properties = RunProperties.new, text = '', parent: nil)
      @properties = properties
      @text = text
      @parent = parent
    end

    # Parse ParagraphRun object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [ParagraphRun] result of parsing
    def parse(node)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'rPr'
          @properties = RunProperties.new(parent: self).parse(node_child)
        when 't'
          @text = node_child.text
        end
      end
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ooxml_parser-0.2.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb