dropboximus_prime 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dropboximus_prime.rb +10 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa43d4b3c61d305a1be82c70b428a02c693e39ee
|
4
|
+
data.tar.gz: c4eb3be8ba1205cca91cb225d012a3100953eb6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ce2cf3ccee61bd7d2dd8bc4f53b25d7005808470581737e38547e47c4285adae7d07dc74ae41c1f1cf2b6b6635babfb86dce4dbda3b6c67f89a0dbf9d12d503
|
7
|
+
data.tar.gz: 76e8e96e74f7390e8225acff8d9d2ff4633112cb1ab03917930a6275ed1f2f16524da61e7267cb986dd358c11f2eec4779ff77ba8843be7b313d286debb188ba
|
data/lib/dropboximus_prime.rb
CHANGED
@@ -83,8 +83,9 @@ class DropboximusPrime
|
|
83
83
|
end
|
84
84
|
|
85
85
|
DPImage = Struct.new(:url, :title, :alt, :thumbnail_s_url, :thumbnail_m_url, :thumbnail_l_url, :thumbnail_xl_url)
|
86
|
-
def imagify
|
87
|
-
|
86
|
+
def imagify local_path
|
87
|
+
relative_path = local_path_to_relative_path local_path
|
88
|
+
url = public_path relative_path
|
88
89
|
|
89
90
|
meta = get_image_meta(relative_path)
|
90
91
|
alt = meta[0]
|
@@ -104,7 +105,7 @@ class DropboximusPrime
|
|
104
105
|
|
105
106
|
def get_image_meta relative_path
|
106
107
|
begin
|
107
|
-
cache_path = cache_path
|
108
|
+
cache_path = cache_path relative_path
|
108
109
|
meta_file_path = File.join(File.dirname(cache_path), '_'+File.basename(cache_path,".*")+'.yml')
|
109
110
|
meta = YAML.load_file(meta_file_path)
|
110
111
|
[
|
@@ -139,6 +140,12 @@ class DropboximusPrime
|
|
139
140
|
new_path
|
140
141
|
end
|
141
142
|
|
143
|
+
def local_path_to_relative_path local_path
|
144
|
+
new_path = local_path.sub(@settings['cache']['path'], '')
|
145
|
+
new_path[0] = '' if new_path[0] == '/'
|
146
|
+
new_path
|
147
|
+
end
|
148
|
+
|
142
149
|
def public_path relative_path
|
143
150
|
File.join(@settings['cache']['http_prefix'], relative_path)
|
144
151
|
end
|