Class: Paperclip::PhantomProcessor
- Inherits:
-
Processor
- Object
- Processor
- Paperclip::PhantomProcessor
- Defined in:
- lib/paperclip_processors/phantom_processor.rb
Overview
Phantom SVG processor for Paperclip
Instance Attribute Summary collapse
-
#dst ⇒ Object
Returns the value of attribute dst.
-
#file ⇒ Object
Returns the value of attribute file.
-
#format ⇒ Object
Returns the value of attribute format.
-
#height ⇒ Object
Returns the value of attribute height.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(file, options = {}, attachment = nil) ⇒ PhantomProcessor
constructor
A new instance of PhantomProcessor.
- #make ⇒ Object
Constructor Details
#initialize(file, options = {}, attachment = nil) ⇒ PhantomProcessor
Returns a new instance of PhantomProcessor.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/paperclip_processors/phantom_processor.rb', line 8 def initialize(file, = {}, = nil) super @format = .fetch(:format, :svg) @height = .fetch(:height, 64) @width = .fetch(:width, 64) @base_name = File.basename(@file.path, '.*') @name = [:output_name] || @base_name @svg = Phantom::SVG::Base.new(@file.path) end |
Instance Attribute Details
#dst ⇒ Object
Returns the value of attribute dst.
7 8 9 |
# File 'lib/paperclip_processors/phantom_processor.rb', line 7 def dst @dst end |
#file ⇒ Object
Returns the value of attribute file.
7 8 9 |
# File 'lib/paperclip_processors/phantom_processor.rb', line 7 def file @file end |
#format ⇒ Object
Returns the value of attribute format.
7 8 9 |
# File 'lib/paperclip_processors/phantom_processor.rb', line 7 def format @format end |
#height ⇒ Object
Returns the value of attribute height.
7 8 9 |
# File 'lib/paperclip_processors/phantom_processor.rb', line 7 def height @height end |
#width ⇒ Object
Returns the value of attribute width.
7 8 9 |
# File 'lib/paperclip_processors/phantom_processor.rb', line 7 def width @width end |
Instance Method Details
#make ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/paperclip_processors/phantom_processor.rb', line 19 def make case @format.to_sym when :svg then _create_svg when :png then _create_png else raise 'Format not supported' end end |