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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dropboximus_prime.rb +10 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa43d4b3c61d305a1be82c70b428a02c693e39ee
4
- data.tar.gz: c4eb3be8ba1205cca91cb225d012a3100953eb6b
3
+ metadata.gz: 0e6e4db56ba162cf32697f0e4894e684aae3315b
4
+ data.tar.gz: dde376c902cee510abfe9706e8b394c7beabd2d2
5
5
  SHA512:
6
- metadata.gz: 7ce2cf3ccee61bd7d2dd8bc4f53b25d7005808470581737e38547e47c4285adae7d07dc74ae41c1f1cf2b6b6635babfb86dce4dbda3b6c67f89a0dbf9d12d503
7
- data.tar.gz: 76e8e96e74f7390e8225acff8d9d2ff4633112cb1ab03917930a6275ed1f2f16524da61e7267cb986dd358c11f2eec4779ff77ba8843be7b313d286debb188ba
6
+ metadata.gz: 9d46f1d3e8a07fa1c2952e756afebf3286affe5681883302e8bfba106d1804475308286649877661bc2fdf4ab046fee25ca9374e7b9eefdd3c222fb8f611ab2b
7
+ data.tar.gz: 5cfc3c3cd6842a52bf8a7adb3574491d26bbec64e70332b3ade16b61565d6cc4b79e20c215a41a14301459b0f0a68efc36787b2a165628300b5684a50ebb6a1d
@@ -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
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.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Burnette