Class: OoxmlParser::SlideSize

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#heightObject

Returns the value of attribute height.



3
4
5
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb', line 3

def height
  @height
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb', line 3

def type
  @type
end

#widthObject

Returns the value of attribute width.



3
4
5
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb', line 3

def width
  @width
end

Class Method Details

.parse(slide_size_node) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb', line 5

def self.parse(slide_size_node)
  slide_size = SlideSize.new
  slide_size_node.attributes.each do |key, value|
    case key
    when 'cx'
      slide_size.width = (value.value.to_f / OoxmlParser.configuration.units_delimiter).round(2)
    when 'cy'
      slide_size.height = (value.value.to_f / OoxmlParser.configuration.units_delimiter).round(2)
    when 'type'
      slide_size.type = value.value.to_sym
    end
  end
  slide_size
end