Class: OoxmlParser::ParagraphSpacing
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::ParagraphSpacing
- Defined in:
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_spacing.rb
Overview
Class for parsing Paragraph Spacing in paragraph properties ‘w:spacing`
Instance Attribute Summary collapse
-
#after ⇒ OoxmlSize
Value of after spacing.
-
#before ⇒ OoxmlSize
Value of before spacing.
-
#line ⇒ OoxmlSize
Value of line spacing.
-
#line_rule ⇒ Symbol
Value of line rule style.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ ParagraphSpacing
Parse ParagraphSpacing.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#after ⇒ OoxmlSize
Returns value of after spacing.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_spacing.rb', line 9 def after @after end |
#before ⇒ OoxmlSize
Returns value of before spacing.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_spacing.rb', line 7 def before @before end |
#line ⇒ OoxmlSize
Returns value of line spacing.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_spacing.rb', line 11 def line @line end |
#line_rule ⇒ Symbol
Returns value of line rule style.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_spacing.rb', line 13 def line_rule @line_rule end |
Instance Method Details
#parse(node) ⇒ ParagraphSpacing
Parse ParagraphSpacing
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/paragraph_spacing.rb', line 18 def parse(node) sorted_attributes(node).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 |