class Rabbit::Parser::Image

Public Class Methods

format_name() click to toggle source
# File lib/rabbit/parser/image.rb, line 13
def format_name
  "image"
end
match?(source) click to toggle source
# File lib/rabbit/parser/image.rb, line 17
def match?(source)
  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
  end
end

Public Instance Methods

parse() click to toggle source
# File lib/rabbit/parser/image.rb, line 34
def parse
  options = {
    :prefix => "image-parser-parse",
    :source => @source,
  }
  TemporaryFile.create(options) do |image|
    @image = image
    @canvas << ImageTitleSlide.new(@image.path)
  end
end