Class: OoxmlParser::GradientStop

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb

Constant Summary

Constants inherited from OOXMLDocumentObject

OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file

Constructor Details

#initialize(position) ⇒ GradientStop

Returns a new instance of GradientStop.



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

def initialize(position)
  @position = position
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



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

def color
  @color
end

#positionObject

Returns the value of attribute position.



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

def position
  @position
end

Class Method Details

.parse(gs_node) ⇒ Object



9
10
11
12
13
# File 'lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb', line 9

def self.parse(gs_node)
  gradient_stop = GradientStop.new(gs_node.attribute('pos').value.to_i / 1_000)
  gs_node.xpath('*').each { |color_node| gradient_stop.color = Color.parse_color(color_node) }
  gradient_stop
end