Class: OoxmlParser::Background
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Background
- Defined in:
- lib/ooxml_parser/pptx_parser/presentation/slide/background.rb
Overview
Class for parsing ‘bg` tag
Instance Attribute Summary collapse
-
#fill ⇒ Object
Returns the value of attribute fill.
-
#properties ⇒ BackgroundProperties
Properties.
-
#shade_to_title ⇒ Object
Returns the value of attribute shade_to_title.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(type = nil, parent: nil) ⇒ Background
constructor
A new instance of Background.
-
#parse(node) ⇒ Background
Parse Background object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(type = nil, parent: nil) ⇒ Background
Returns a new instance of Background.
11 12 13 14 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/background.rb', line 11 def initialize(type = nil, parent: nil) @type = type super(parent: parent) end |
Instance Attribute Details
#fill ⇒ Object
Returns the value of attribute fill.
7 8 9 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/background.rb', line 7 def fill @fill end |
#properties ⇒ BackgroundProperties
Returns properties.
9 10 11 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/background.rb', line 9 def properties @properties end |
#shade_to_title ⇒ Object
Returns the value of attribute shade_to_title.
7 8 9 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/background.rb', line 7 def shade_to_title @shade_to_title end |
Instance Method Details
#parse(node) ⇒ Background
Parse Background object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/background.rb', line 19 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'bgPr' @properties = BackgroundProperties.new(parent: self).parse(node_child) end end background_properties_node = node.xpath('p:bgPr').first if background_properties_node @shade_to_title = attribute_enabled?(background_properties_node, 'shadeToTitle') @fill = PresentationFill.new(parent: self).parse(background_properties_node) end self end |