class Ebookie::Document::Image

Attributes

file[R]

Public Class Methods

new(filepath) click to toggle source
# File lib/ebookie/document/image.rb, line 7
def initialize(filepath)
  self.file = filepath
end

Public Instance Methods

basename() click to toggle source
# File lib/ebookie/document/image.rb, line 23
def basename
  File.basename(file) if file
end
file=(path) click to toggle source
# File lib/ebookie/document/image.rb, line 11
def file=(path)
  if File.exists?(path) || path.match(/http[s]?:\/\//)
    if File.extname(path) == '.png'
      @file = Pathname.new(path)
    else
      Ebookie.logger.warn "Image file is not a valid png for '#{path}'"
    end
  else
    Ebookie.logger.warn "Image file does not exist for '#{path}'"
  end
end