Module: Imgry

Extended by:
Imgry
Included in:
Imgry
Defined in:
lib/imgry.rb,
lib/imgry/version.rb,
lib/imgry/geometry.rb,
lib/imgry/processor.rb,
lib/imgry/processor/img_scalr.rb,
lib/imgry/processor/mini_magick.rb,
lib/imgry/processor/image_voodoo.rb,
lib/imgry/processor/java_adapter.rb

Defined Under Namespace

Modules: Geometry, Processor Classes: Error, FileUnreadableError, FileUnwritableError, InvalidImageError, UnsupportedFormatError

Constant Summary collapse

VERSION =
'0.1.12'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#processorObject

Returns the value of attribute processor.



4
5
6
# File 'lib/imgry.rb', line 4

def processor
  @processor
end

Instance Method Details

#from_file(path) ⇒ Object



10
11
12
# File 'lib/imgry.rb', line 10

def from_file(path)
  processor_klass.from_file(path)
end

#processor_klassObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/imgry.rb', line 14

def processor_klass
  @processor_klass ||= begin
    k = processor.to_s.split('_').map {|x| x.capitalize }.join('')
    begin
      instance_eval("Imgry::Processor::#{k}")
    rescue
      raise "Unknown processor #{processor}"
    end
  end
end

#with_bytes(img_blob) ⇒ Object



6
7
8
# File 'lib/imgry.rb', line 6

def with_bytes(img_blob)
  processor_klass.with_bytes(img_blob)
end