echo_uploads 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a19cdd2aff5a28b347afebdf8935726149ef8843
4
- data.tar.gz: c4889c53066a7d7864f88b1a0bf2753a24438c03
3
+ metadata.gz: c825aebbee0892448c87fe8ebdaa444e34f9c5b4
4
+ data.tar.gz: 81e02dd1c89d5ca630b6474bc7462d50908c7ab1
5
5
  SHA512:
6
- metadata.gz: 9ab54bb35760568dc29cd84e6827c004b093adcdf2e9de2c6a180d4dfdf337b16ea9b432cd08cb01362596a8f2c248a9f64f1900b54dc7473c441a0412755de4
7
- data.tar.gz: c3c9ea0f24c22092e1b5566c6b78d234caa9b469f65e44188a830fca18be19625f8f9d5b7073679239648048784ffc4756fbfb21193ef7250854e3511c15a339
6
+ metadata.gz: af5bf823ba0b90118b26850a43c3301bbe152a5019325bd6cc747c8b4bc94f6bdfad0ba4bc440d567059e7635776c8892b2ffb73fe3e637f894282b973872c61
7
+ data.tar.gz: 80c001c00413726cf371bf1f76003a82824c909b3440c14846a35939f3604b92a456dd2b490ec9a48eb41b9c347ed50d9e985f38508bf12a51cf0f6a145e10c0
@@ -151,6 +151,26 @@ module EchoUploads
151
151
  echo_uploads_map_metadata(attr, options, &:key)
152
152
  end
153
153
 
154
+ # Define the storage method.
155
+ define_method("#{attr}_storage") do
156
+ echo_uploads_map_metadata(attr, options, &:storage)
157
+ end
158
+
159
+ # Define the url method.
160
+ define_method("#{attr}_url") do |options = {}|
161
+ echo_uploads_map_metadata(attr, options) do |meta|
162
+ if meta.storage.respond_to?(:url)
163
+ meta.storage.url meta.key, options
164
+ else
165
+ raise(
166
+ NoMethodError,
167
+ "The Echo Uploads file store you've selected, " +
168
+ "{meta.storage.class.to_s}, does not support the #url method."
169
+ )
170
+ end
171
+ end
172
+ end
173
+
154
174
  # Define the has_x? method. Returns true if a permanent or temporary file has been
155
175
  # persisted, or if a file (which may not be valid) has been uploaded this request
156
176
  # cycle.
@@ -1,3 +1,3 @@
1
1
  module EchoUploads
2
- VERSION = '0.0.13'
2
+ VERSION = '0.0.14'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: echo_uploads
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarrett Colby