class OoxmlParser::HeaderFooterChild
Class for parsing header or footer
Attributes
@return [String] raw text of header
@return [Symbol] type of header
Public Class Methods
Source
# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer/header_footer_child.rb, line 11 def initialize(type: nil, raw_string: nil, parent: nil) @type = type @raw_string = raw_string super(parent: parent) end
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
Public Instance Methods
Source
# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer/header_footer_child.rb, line 36 def center return @center if @center center = @raw_string.split('&R').first.match(/&C(.+)/) return nil unless center @center = center[1] end
@return [String] center part of header
Source
# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer/header_footer_child.rb, line 46 def left return @left if @left left = @raw_string.gsub("&R#{right}", '') left = left.gsub("&C#{center}", '') return nil if left == '' left.gsub('&L', '') end
@return [String] left part of header
Source
# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer/header_footer_child.rb, line 20 def parse(node) @raw_string = node.text self end
Parse HeaderFooterChild
data @param node [Nokogiri::XML:Element] node to parse @return [HeaderFooterChild] result of parsing
Source
# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer/header_footer_child.rb, line 26 def right return @right if @right right = @raw_string.match(/&R(.+)/) return nil unless right @right = right[1] end
@return [String] right part of header