Class: OoxmlParser::LinearGradient

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(angle = nil, scaled = nil) ⇒ LinearGradient

Returns a new instance of LinearGradient.



5
6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb', line 5

def initialize(angle = nil, scaled = nil)
  @angle = angle
  @scaled = scaled
end

Instance Attribute Details

#angleObject

Returns the value of attribute angle.



3
4
5
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb', line 3

def angle
  @angle
end

#scaledObject

Returns the value of attribute scaled.



3
4
5
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb', line 3

def scaled
  @scaled
end

Class Method Details

.parse(node) ⇒ LinearGradient

Parse LinearGradient object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



13
14
15
16
17
18
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb', line 13

def self.parse(node)
  gradient = LinearGradient.new
  gradient.angle = node.attribute('ang').value.to_f / 100_000.0 if node.attribute('ang')
  gradient.scaled = node.attribute('scaled').value.to_i if node.attribute('scaled')
  gradient
end