dropboximus_prime 0.2.3 → 0.2.4
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 -1
- 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: 0e6e4db56ba162cf32697f0e4894e684aae3315b
|
4
|
+
data.tar.gz: dde376c902cee510abfe9706e8b394c7beabd2d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d46f1d3e8a07fa1c2952e756afebf3286affe5681883302e8bfba106d1804475308286649877661bc2fdf4ab046fee25ca9374e7b9eefdd3c222fb8f611ab2b
|
7
|
+
data.tar.gz: 5cfc3c3cd6842a52bf8a7adb3574491d26bbec64e70332b3ade16b61565d6cc4b79e20c215a41a14301459b0f0a68efc36787b2a165628300b5684a50ebb6a1d
|
data/lib/dropboximus_prime.rb
CHANGED
@@ -79,7 +79,8 @@ class DropboximusPrime
|
|
79
79
|
return YAML.load_file(path) if is_yaml?(path)
|
80
80
|
return @markdown.render(File.read(path)) if is_markdown?(path)
|
81
81
|
return imagify(path) if is_image?(path)
|
82
|
-
return File.read(path)
|
82
|
+
return File.read(path) if is_raw?(path)
|
83
|
+
return public_path(local_path_to_relative_path(path)) if is_download?(path)
|
83
84
|
end
|
84
85
|
|
85
86
|
DPImage = Struct.new(:url, :title, :alt, :thumbnail_s_url, :thumbnail_m_url, :thumbnail_l_url, :thumbnail_xl_url)
|
@@ -202,6 +203,14 @@ class DropboximusPrime
|
|
202
203
|
thumbnail_suffixes.any? { |word| File.basename(path, ".*").end_with?(word) }
|
203
204
|
end
|
204
205
|
|
206
|
+
def is_raw? path
|
207
|
+
['.txt'].any? { |word| path.end_with?(word) }
|
208
|
+
end
|
209
|
+
|
210
|
+
def is_download? path
|
211
|
+
['.pdf', '.doc', '.xls', '.docx', '.xlsx'].any? { |word| path.end_with?(word) }
|
212
|
+
end
|
213
|
+
|
205
214
|
def init_markdown
|
206
215
|
Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
|
207
216
|
end
|