Class: OoxmlParser::FontScheme

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/pptx_parser/presentation/presentation_theme/font_scheme.rb

Overview

Class for parsing ‘fontScheme` tag

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#major_fontFontCollection (readonly)

Returns major font data.

Returns:



10
11
12
# File 'lib/ooxml_parser/pptx_parser/presentation/presentation_theme/font_scheme.rb', line 10

def major_font
  @major_font
end

#minor_fontFontCollection (readonly)

Returns minor font data.

Returns:



12
13
14
# File 'lib/ooxml_parser/pptx_parser/presentation/presentation_theme/font_scheme.rb', line 12

def minor_font
  @minor_font
end

#nameString (readonly)

Returns name of font.

Returns:

  • (String)

    name of font



8
9
10
# File 'lib/ooxml_parser/pptx_parser/presentation/presentation_theme/font_scheme.rb', line 8

def name
  @name
end

Instance Method Details

#parse(node) ⇒ FontScheme

Parse FontScheme object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ooxml_parser/pptx_parser/presentation/presentation_theme/font_scheme.rb', line 17

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'name'
      @name = value.value.to_s
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'majorFont'
      @major_font = FontCollection.new(parent: self).parse(node_child)
    when 'minorFont'
      @minor_font = FontCollection.new(parent: self).parse(node_child)
    end
  end
  self
end