Class: Svg2pdf::Processor
- Inherits:
-
Object
- Object
- Svg2pdf::Processor
- Defined in:
- lib/svg2pdf.rb
Instance Method Summary collapse
-
#initialize(input, mode, format, options) ⇒ Processor
constructor
A new instance of Processor.
- #process ⇒ Object
Constructor Details
#initialize(input, mode, format, options) ⇒ Processor
Returns a new instance of Processor.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/svg2pdf.rb', line 53 def initialize(input, mode, format, ) @svg = input @mode = format @mode = :jpeg if @mode == :jpg if mode == :from_data @handle = RSVG::Handle.new_from_data(@svg) else @handle = RSVG::Handle.new_from_file(@svg) end end |
Instance Method Details
#process ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/svg2pdf.rb', line 65 def process case @mode when :jpeg, :jpg, :png then render_image when :pdf, :ps then render else raise Svg2pdf::UnsupportedFormatError, "Invalid output format: %s" % @mode.to_s end end |