Class: OoxmlParser::ParagraphSpacing
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::ParagraphSpacing
- Defined in:
- lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_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) ⇒ Position
Parse Position.
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, #initialize, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#after ⇒ OoxmlSize
Returns value of after spacing.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb', line 7 def after @after end |
#before ⇒ OoxmlSize
Returns value of before spacing.
5 6 7 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb', line 5 def before @before end |
#line ⇒ OoxmlSize
Returns value of line spacing.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb', line 9 def line @line end |
#line_rule ⇒ Symbol
Returns value of line rule style.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb', line 11 def line_rule @line_rule end |
Instance Method Details
#parse(node) ⇒ Position
Parse Position
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb', line 16 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 |