Class: OoxmlParser::DocumentGrid

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb

Constant Summary

Constants inherited from OOXMLDocumentObject

OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file

Constructor Details

#initialize(type = nil, line_pitch = nil, char_space = nil) ⇒ DocumentGrid

Returns a new instance of DocumentGrid.



5
6
7
8
9
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb', line 5

def initialize(type = nil, line_pitch = nil, char_space = nil)
  @type = type
  @line_pitch = line_pitch
  @char_space = char_space
end

Instance Attribute Details

#char_spaceObject

Returns the value of attribute char_space.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb', line 3

def char_space
  @char_space
end

#line_pitchObject

Returns the value of attribute line_pitch.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb', line 3

def line_pitch
  @line_pitch
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb', line 3

def type
  @type
end

Class Method Details

.parse(node) ⇒ DocumentGrid

Parse DocumentGrid

Parameters:

  • node (Nokogiri::XML:Element)

    with DocumentGrid

Returns:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb', line 14

def self.parse(node)
  document_grid = DocumentGrid.new
  node.attributes.each do |key, value|
    case key
    when 'charSpace'
      document_grid.char_space = value.value
    when 'linePitch'
      document_grid.line_pitch = value.value.to_i
    when 'type'
      document_grid.type = value.value
    end
  end
  document_grid
end