Class: DYI::Formatter::PngFormatter
- Inherits:
-
Object
- Object
- DYI::Formatter::PngFormatter
- Defined in:
- lib/dyi/formatter/svg_formatter.rb
Overview
Instance Method Summary collapse
-
#initialize(*args) ⇒ PngFormatter
constructor
A new instance of PngFormatter.
- #save(file_name, options = {}) ⇒ Object
- #string ⇒ Object
Constructor Details
#initialize(*args) ⇒ PngFormatter
Returns a new instance of PngFormatter.
813 814 815 |
# File 'lib/dyi/formatter/svg_formatter.rb', line 813 def initialize(*args) @svg_formatter = SvgFormatter.new(*args) end |
Instance Method Details
#save(file_name, options = {}) ⇒ Object
797 798 799 800 801 |
# File 'lib/dyi/formatter/svg_formatter.rb', line 797 def save(file_name, ={}) IO.popen("rsvg-convert -f png -o #{file_name}", 'w+b') {|io| io.puts(@svg_formatter.string) } end |
#string ⇒ Object
803 804 805 806 807 808 809 810 811 |
# File 'lib/dyi/formatter/svg_formatter.rb', line 803 def string results = '' IO.popen("rsvg-convert -f png", 'w+') {|io| io.puts(@svg_formatter.string) io.close_write io.read(nil, results) } results end |