Class: Scruffy::Components::StyleInfo
- Defined in:
- lib/scruffy/components/style_info.rb
Overview
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.
Instance Attribute Summary
Attributes inherited from Base
#id, #options, #position, #size, #visible
Instance Method Summary collapse
-
#initialize(*args) ⇒ StyleInfo
constructor
A new instance of StyleInfo.
- #process(svg, options = {}) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(*args) ⇒ StyleInfo
Returns a new instance of StyleInfo.
8 9 10 11 12 |
# File 'lib/scruffy/components/style_info.rb', line 8 def initialize(*args) super @visible = false end |
Instance Method Details
#process(svg, options = {}) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/scruffy/components/style_info.rb', line 13 def process(svg, ={}) svg.defs { svg.style(:type => "text/css") { svg.cdata!("\n#{[:selector]} {\n #{[:style]}\n}\n") } } end |