class OoxmlParser::SpacingValuedChild
Class to describe spacing valued child
Attributes
spacing_percent[R]
@return [ValuedChild] spacing percent
spacing_points[R]
@return [ValuedChild] spacing point
Public Instance Methods
parse(node)
click to toggle source
Parse LineSpacing object @param node [Nokogiri::XML:Element] node to parse @return [LineSpacing] result of parsing
# File lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/spacing/spacing_valued_child.rb, line 14 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'spcPct' @spacing_percent = ValuedChild.new(:float, parent: self).parse(node_child) when 'spcPts' @spacing_points = ValuedChild.new(:float, parent: self).parse(node_child) end end self end
rule()
click to toggle source
@return [Symbol] rule used to determine line spacing
# File lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/spacing/spacing_valued_child.rb, line 36 def rule return :multiple if @spacing_percent :exact end
to_ooxml_size()
click to toggle source
Convert to OoxmlSize
@return [OoxmlSize]
# File lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/spacing/spacing_valued_child.rb, line 28 def to_ooxml_size return OoxmlSize.new(@spacing_percent.value, :one_1000th_percent) if @spacing_percent return OoxmlSize.new(@spacing_points.value, :spacing_point) if @spacing_points raise 'Unknown spacing child type' end