Class: OoxmlParser::Indents
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Indents
- Defined in:
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/indents.rb
Overview
Class for working with Indents data
Instance Attribute Summary collapse
-
#first_line_indent ⇒ Object
(also: #first_line)
Returns the value of attribute first_line_indent.
-
#hanging_indent ⇒ Object
(also: #hanging)
Returns the value of attribute hanging_indent.
-
#left_indent ⇒ Object
(also: #left)
Returns the value of attribute left_indent.
-
#right_indent ⇒ Object
(also: #right)
Returns the value of attribute right_indent.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(first_line_indent = OoxmlSize.new(0), left_indent = OoxmlSize.new(0), right_indent = OoxmlSize.new(0), hanging_indent = OoxmlSize.new(0), parent: nil) ⇒ Indents
constructor
A new instance of Indents.
-
#parse(node) ⇒ Indents
Parse Indents.
-
#to_s ⇒ String
Convert to string.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(first_line_indent = OoxmlSize.new(0), left_indent = OoxmlSize.new(0), right_indent = OoxmlSize.new(0), hanging_indent = OoxmlSize.new(0), parent: nil) ⇒ Indents
Returns a new instance of Indents.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/indents.rb', line 8 def initialize(first_line_indent = OoxmlSize.new(0), left_indent = OoxmlSize.new(0), right_indent = OoxmlSize.new(0), hanging_indent = OoxmlSize.new(0), parent: nil) @first_line_indent = first_line_indent @left_indent = left_indent @right_indent = right_indent @hanging_indent = hanging_indent super(parent: parent) end |
Instance Attribute Details
#first_line_indent ⇒ Object Also known as: first_line
Returns the value of attribute first_line_indent.
6 7 8 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/indents.rb', line 6 def first_line_indent @first_line_indent end |
#hanging_indent ⇒ Object Also known as: hanging
Returns the value of attribute hanging_indent.
6 7 8 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/indents.rb', line 6 def hanging_indent @hanging_indent end |
#left_indent ⇒ Object Also known as: left
Returns the value of attribute left_indent.
6 7 8 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/indents.rb', line 6 def left_indent @left_indent end |
#right_indent ⇒ Object Also known as: right
Returns the value of attribute right_indent.
6 7 8 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/indents.rb', line 6 def right_indent @right_indent end |
Instance Method Details
#parse(node) ⇒ Indents
Parse Indents
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/indents.rb', line 35 def parse(node) node.attributes.each do |key, value| case key when 'firstLine' @first_line_indent = OoxmlSize.new(value.value.to_f) when 'left' @left_indent = OoxmlSize.new(value.value.to_f) when 'right' @right_indent = OoxmlSize.new(value.value.to_f) when 'hanging' @hanging_indent = OoxmlSize.new(value.value.to_f) end end self end |
#to_s ⇒ String
Convert to string
27 28 29 30 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/indents.rb', line 27 def to_s "first line indent: #{@first_line_indent}, left indent: #{@left_indent}, " \ "right indent: #{@right_indent}, hanging indent: #{@hanging_indent}" end |