Class: RGhost::Image
Overview
Super class of GIF and JPEG.
Constant Summary collapse
- DEFAULT_OPTIONS =
{:x=> :limit_left, :y=> 1, :zoom => 100, :rotate => 0}
Class Method Summary collapse
-
.for(path, options = {}) ⇒ Object
Facade method for load image by file extension.
Instance Method Summary collapse
-
#initialize(image_path, options = {}) ⇒ Image
constructor
A new instance of Image.
Methods inherited from PsObject
#<<, #call, #graphic_scope, #ps, #raw, #set, #to_s
Constructor Details
#initialize(image_path, options = {}) ⇒ Image
Returns a new instance of Image.
6 7 8 9 10 |
# File 'lib/rghost/image.rb', line 6 def initialize(image_path,={}) super("") @options=DEFAULT_OPTIONS.dup.merge() @file=image_path end |
Class Method Details
.for(path, options = {}) ⇒ Object
Facade method for load image by file extension. Uses Eps, Gif and Jpeg class. Accepts gif, jpeg, jpg and eps
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rghost/image.rb', line 13 def self.for(path,={}) clazz=case path when /gif$/i then RGhost::Gif when /jpe?g$/i then RGhost::Jpeg when /(eps|template)$/i then RGhost::Eps else raise NameError.new("Unsupported format") end clazz.new(path,) end |