lib/rabbit/parser/image.rb in rabbit-2.0.2 vs lib/rabbit/parser/image.rb in rabbit-2.0.3
- old
+ new
@@ -9,23 +9,31 @@
class Image < Base
push_loader(self)
class << self
def match?(source)
- begin
- Rabbit::TemporaryFile.make(source.read, "image") do |input|
+ options = {
+ :prefix => "image-parser-match",
+ :source => source,
+ }
+ Rabbit::TemporaryFile.create(options) do |input|
+ begin
Rabbit::ImageLoader.new(input.path)
+ true
+ rescue Rabbit::ImageLoadError
+ false
end
- true
- rescue Rabbit::ImageLoadError
- false
end
end
end
include Element
def parse
- TemporaryFile.make(@source.read, "image") do |image|
+ options = {
+ :prefix => "image-parser-parse",
+ :source => @source,
+ }
+ TemporaryFile.create(options) do |image|
@image = image
@canvas << ImageTitleSlide.new(@image.path)
end
end
end