class ImgOverlay::Helper

Public Class Methods

get_input_image(input_hash) click to toggle source
# File lib/img_overlay/helper.rb, line 9
def get_input_image input_hash
  if is_image_url_given?(input_hash)
    get_image_path_from_url(input_hash[:url])
  else
    input_hash[:path]
  end
end

Private Class Methods

get_image_path_from_url(url) click to toggle source
# File lib/img_overlay/helper.rb, line 19
def get_image_path_from_url(url)
  otuput = get_temp_file_path
  id = ImgOverlay::ImageDownloader.new(
    url: url,
    path: otuput  
  )
  if id.download!
    return otuput
  else
    return nil
  end
end
get_temp_file_path() click to toggle source
# File lib/img_overlay/helper.rb, line 32
def get_temp_file_path
  temp_file = Tempfile.new('image')
  temp_file.path
end
is_image_url_given?(input_hash) click to toggle source
# File lib/img_overlay/helper.rb, line 37
def is_image_url_given? input_hash
  return false if input_hash[:url].nil?
  return true
end