class OoxmlParser::PageMargins
Class for parsing ‘pgMar` tags
Attributes
bottom[RW]
gutter[RW]
header[RW]
left[RW]
right[RW]
top[RW]
Public Class Methods
new(params)
click to toggle source
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb, line 8 def initialize(params) @top = params[:top] @bottom = params[:bottom] @left = params[:left] @right = params[:right] @header = params[:header] @footer = params[:footer] @gutter = params[:gutter] @parent = params[:parent] super(parent: nil) end
Public Instance Methods
parse(node, unit = :dxa)
click to toggle source
Parse BordersProperties
@param [Nokogiri::XML:Element] node with PageMargins
@return [PageMargins] value of PageMargins
# File lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb, line 23 def parse(node, unit = :dxa) node.attributes.each do |key, value| case key when 'top' @top = OoxmlSize.new(value.value.to_f, unit) when 'left' @left = OoxmlSize.new(value.value.to_f, unit) when 'right' @right = OoxmlSize.new(value.value.to_f, unit) when 'bottom' @bottom = OoxmlSize.new(value.value.to_f, unit) when 'header' @header = OoxmlSize.new(value.value.to_f, unit) when 'footer' @footer = OoxmlSize.new(value.value.to_f, unit) when 'gutter' @gutter = OoxmlSize.new(value.value.to_f, unit) end end self end