Class: SVGPalette

Inherits:
Object
  • Object
show all
Defined in:
lib/svg_palette.rb

Constant Summary collapse

PROPERTIES =
%w(
  fill stroke stop-color flood-color lighting-color style
).freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml_string) ⇒ SVGPalette

Returns a new instance of SVGPalette.



10
11
12
# File 'lib/svg_palette.rb', line 10

def initialize(xml_string)
  @xml = Nokogiri::XML(xml_string)
end

Class Method Details

.parse(xml_string) ⇒ Object



14
15
16
# File 'lib/svg_palette.rb', line 14

def self.parse(xml_string)
  new(xml_string).parse
end

Instance Method Details

#parseObject



18
19
20
# File 'lib/svg_palette.rb', line 18

def parse
  squash(values.map { |v| CSSColor.parse(v) rescue nil })
end