dropboximus_prime 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dropboximus_prime.rb +10 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca2f9199ba6a28a648866d4b3ede9f14a4900911
4
- data.tar.gz: 8d7c0858c5631684acb486cae5fae9215a27dd33
3
+ metadata.gz: aa43d4b3c61d305a1be82c70b428a02c693e39ee
4
+ data.tar.gz: c4eb3be8ba1205cca91cb225d012a3100953eb6b
5
5
  SHA512:
6
- metadata.gz: 9ea9a0a358ec81b2081ed3173ea9eb6e3b4db977e375ae9d450aff30c01cb59140b23181a66ffab62c53c16c4b2a961b82a43812dfefece392bc249b6c00e3fb
7
- data.tar.gz: 20ba95fe3e91dcd40c07cbefaaa6833105fc31d71cfbb27469ea04b8231de9066992bae5eccdebff23ca901f806de2ddbb3aeb5fb47a4e02a2e30e093fed1261
6
+ metadata.gz: 7ce2cf3ccee61bd7d2dd8bc4f53b25d7005808470581737e38547e47c4285adae7d07dc74ae41c1f1cf2b6b6635babfb86dce4dbda3b6c67f89a0dbf9d12d503
7
+ data.tar.gz: 76e8e96e74f7390e8225acff8d9d2ff4633112cb1ab03917930a6275ed1f2f16524da61e7267cb986dd358c11f2eec4779ff77ba8843be7b313d286debb188ba
@@ -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 relative_path
87
- url = public_path(relative_path)
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(relative_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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dropboximus_prime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Burnette