nokaya 0.0.8 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,40 +0,0 @@
1
- # encoding: utf-8
2
- module Nokaya
3
- class Image
4
-
5
- def self.photo_name nokaya
6
- path = self.out nokaya
7
- if nokaya.options[:name]
8
- "#{path}/#{nokaya.type.to_s}-#{nokaya.options[:name]}.jpg"
9
- else
10
- "#{path}/#{nokaya.type.to_s}-#{Time.now.to_i}.jpg"
11
- end
12
- end
13
-
14
- def self.save_image path, link
15
- content = self.get_image link
16
- f = File.new(path, "wb")
17
- f.puts(content)
18
- f.close
19
- end
20
-
21
- def self.get_image img_link
22
- begin
23
- open(img_link).read
24
- rescue
25
- abort Status.no_can_do
26
- end
27
- end
28
-
29
- private
30
-
31
- def self.out nokaya
32
- if nokaya.options[:output]
33
- nokaya.options[:output]
34
- else
35
- Dir.home + "/Downloads"
36
- end
37
- end
38
-
39
- end
40
- end