Sha256: deedd85fb419653da7e77a5b9012e0c57befbb1bbe8b576ebdf9cbb3aad7483c

Contents?: true

Size: 587 Bytes

Versions: 2

Compression:

Stored size: 587 Bytes

Contents

# encoding: utf-8
module Nokaya
  class Image
    def self.photo_name nokaya
      unless nokaya.options[:name]
        Dir.home + "/Downloads/#{nokaya.type.to_s}-#{Time.now.to_i}.jpg"
      else
        Dir.home + "/Downloads/#{nokaya.type.to_s}-#{nokaya.options[:name]}.jpg"
      end
    end
    def self.save_image path, link
      content = self.get_image link
      f = File.new(path, "wb")
        f.puts(content)
      f.close
    end
    def self.get_image img_link
      begin
        open(img_link).read
      rescue
        abort Status.no_can_do
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nokaya-0.0.7 lib/nokaya/image.rb
nokaya-0.0.6 lib/nokaya/image.rb