echo_uploads 0.0.21 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/echo_uploads/model.rb +13 -17
- data/lib/echo_uploads/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab518cb10d7eba1c95a48a067e4bb86d923e143b
|
4
|
+
data.tar.gz: a180ec2f68fd32cf759c28975acc1c362106c294
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd6a3b2988b4bd5599583c76d58c6a9540d77c514be8386b78d9a8d53bf7a92868ca1b984f001468ee0c1ac827c7feaf79290f4a77be3286494b46e3ecd8d56d
|
7
|
+
data.tar.gz: 34460a5a568fc04096fdd77ebae11baf02e0837ae486f1fbc36a64d39bf23051222bce489de15be73d1e86ab09b79146899bc1355028b5a8d3dd5adc5163240b
|
data/lib/echo_uploads/model.rb
CHANGED
@@ -120,11 +120,17 @@ module EchoUploads
|
|
120
120
|
self.echo_uploads_config = echo_uploads_config.merge attr => {}
|
121
121
|
|
122
122
|
# Define reader method for the file attribute.
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
123
|
+
if Rails::VERSION::MAJOR >= 5
|
124
|
+
attribute attr
|
125
|
+
else
|
126
|
+
attr_reader attr
|
127
|
+
end
|
128
|
+
|
129
|
+
# Define the accessor methods for the mapped version(s) of the file. Returns
|
130
|
+
# an array.
|
131
|
+
define_method("mapped_#{attr}") do
|
132
|
+
unless instance_variable_get("@mapped_#{attr}")
|
133
|
+
file = send attr
|
128
134
|
mapper = ::EchoUploads::Mapper.new file
|
129
135
|
if options[:map].is_a? Proc
|
130
136
|
options[:map].call file, mapper
|
@@ -133,21 +139,11 @@ module EchoUploads
|
|
133
139
|
end
|
134
140
|
# Write an array of ActionDispatch::Http::UploadedFile objects to the instance
|
135
141
|
# variable.
|
136
|
-
|
142
|
+
instance_variable_set("@mapped_#{attr}", mapper.outputs)
|
137
143
|
end
|
138
|
-
|
139
|
-
if attr
|
140
|
-
# Mark as dirty.
|
141
|
-
attribute_will_change! attr
|
142
|
-
end
|
143
|
-
|
144
|
-
instance_variable_set "@#{attr}", file
|
144
|
+
instance_variable_get("@mapped_#{attr}")
|
145
145
|
end
|
146
146
|
|
147
|
-
# Define the accessor methods for the mapped version(s) of the file. Returns
|
148
|
-
# an array.
|
149
|
-
attr_accessor "mapped_#{attr}"
|
150
|
-
|
151
147
|
# Define the original filename method.
|
152
148
|
define_method("#{attr}_original_filename") do
|
153
149
|
echo_uploads_map_metadata(attr, options, &:original_filename)
|
data/lib/echo_uploads/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: echo_uploads
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jarrett Colby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.
|
84
|
+
rubygems_version: 2.6.8
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: Uploaded files for Rails
|