class Scruffy::Components::StyleInfo
Component used for adding CSS styling to SVG graphs.
In hindsight, ImageMagick and Mozilla SVG's handling of CSS styling is extremely inconsistant, so use this at your own risk.
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
Scruffy::Components::Base.new
# File lib/scruffy/components/style_info.rb, line 8 def initialize(*args) super @visible = false end
Public Instance Methods
process(svg, options={})
click to toggle source
# File lib/scruffy/components/style_info.rb, line 13 def process(svg, options={}) svg.defs { svg.style(:type => "text/css") { svg.cdata!("\n#{options[:selector]} {\n #{options[:style]}\n}\n") } } end