class OoxmlParser::Indents

Class for working with Indents data

Attributes

first_line[RW]
first_line_indent[RW]
hanging[RW]
hanging_indent[RW]
left[RW]
left_indent[RW]
right[RW]
right_indent[RW]

Public Class Methods

new(first_line_indent = OoxmlSize.new(0), left_indent = OoxmlSize.new(0), right_indent = OoxmlSize.new(0), hanging_indent = OoxmlSize.new(0), parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/docx_parser/docx_data/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

Public Instance Methods

parse(node) click to toggle source

Parse Indents @param [Nokogiri::XML:Element] node with Indents @return [Indents] value of Indents

# File lib/ooxml_parser/docx_parser/docx_data/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() click to toggle source

Convert to string @return [String] result of conversion

# File lib/ooxml_parser/docx_parser/docx_data/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