Class: ImageRuby::DecoderLoader

Inherits:
FileLoader show all
Defined in:
lib/imageruby/persistor/decoder_loader.rb

Instance Method Summary collapse

Methods inherited from FileLoader

load

Instance Method Details

#load(path) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/imageruby/persistor/decoder_loader.rb', line 25

def load(path)
  content = nil
  File.open(path,"rb") do |file|
    content = file.read
  end

  begin
    ImageRuby::Decoder.decode(content, ImageRuby::Image)
  rescue ImageRuby::Decoder::UnableToDecodeException
    raise UnableToLoadException
  end
end