pothoven-attachment_fu 3.2.0 → 3.2.1
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.
- data/lib/technoweenie/attachment_fu.rb +8 -8
- metadata +1 -1
@@ -96,7 +96,7 @@ module Technoweenie # :nodoc:
|
|
96
96
|
options[:thumbnail_class] ||= self
|
97
97
|
options[:s3_access] ||= :public_read
|
98
98
|
options[:cloudfront] ||= false
|
99
|
-
options[:content_type] = [options[:content_type]].flatten.collect! { |t| t == :image ? Technoweenie::AttachmentFu.content_types : t }.flatten unless options[:content_type].nil?
|
99
|
+
options[:content_type] = [options[:content_type]].flatten.collect! { |t| t == :image ? ::Technoweenie::AttachmentFu.content_types : t }.flatten unless options[:content_type].nil?
|
100
100
|
|
101
101
|
unless options[:thumbnails].is_a?(Hash)
|
102
102
|
raise ArgumentError, ":thumbnails option should be a hash: e.g. :thumbnails => { :foo => '50x50' }"
|
@@ -132,16 +132,16 @@ module Technoweenie # :nodoc:
|
|
132
132
|
m.belongs_to :parent, :class_name => "::#{base_class}" unless options[:thumbnails].empty?
|
133
133
|
end
|
134
134
|
|
135
|
-
storage_mod = Technoweenie::AttachmentFu::Backends.const_get("#{options[:storage].to_s.classify}Backend")
|
135
|
+
storage_mod = ::Technoweenie::AttachmentFu::Backends.const_get("#{options[:storage].to_s.classify}Backend")
|
136
136
|
include storage_mod unless included_modules.include?(storage_mod)
|
137
137
|
|
138
138
|
case attachment_options[:processor]
|
139
139
|
when :none, nil
|
140
|
-
processors = Technoweenie::AttachmentFu.default_processors.dup
|
140
|
+
processors = ::Technoweenie::AttachmentFu.default_processors.dup
|
141
141
|
begin
|
142
142
|
if processors.any?
|
143
143
|
attachment_options[:processor] = processors.first
|
144
|
-
processor_mod = Technoweenie::AttachmentFu::Processors.const_get("#{attachment_options[:processor].to_s.classify}Processor")
|
144
|
+
processor_mod = ::Technoweenie::AttachmentFu::Processors.const_get("#{attachment_options[:processor].to_s.classify}Processor")
|
145
145
|
include processor_mod unless included_modules.include?(processor_mod)
|
146
146
|
end
|
147
147
|
rescue Object, Exception
|
@@ -152,7 +152,7 @@ module Technoweenie # :nodoc:
|
|
152
152
|
end
|
153
153
|
else
|
154
154
|
begin
|
155
|
-
processor_mod = Technoweenie::AttachmentFu::Processors.const_get("#{attachment_options[:processor].to_s.classify}Processor")
|
155
|
+
processor_mod = ::Technoweenie::AttachmentFu::Processors.const_get("#{attachment_options[:processor].to_s.classify}Processor")
|
156
156
|
include processor_mod unless included_modules.include?(processor_mod)
|
157
157
|
rescue Object, Exception
|
158
158
|
raise unless load_related_exception?($!)
|
@@ -176,7 +176,7 @@ module Technoweenie # :nodoc:
|
|
176
176
|
end
|
177
177
|
|
178
178
|
module ClassMethods
|
179
|
-
delegate :content_types, :to => Technoweenie::AttachmentFu
|
179
|
+
delegate :content_types, :to => ::Technoweenie::AttachmentFu
|
180
180
|
|
181
181
|
# Performs common validations for attachment models.
|
182
182
|
def validates_as_attachment
|
@@ -250,7 +250,7 @@ module Technoweenie # :nodoc:
|
|
250
250
|
|
251
251
|
# Copies the given file path to a new tempfile, returning the closed tempfile.
|
252
252
|
def copy_to_temp_file(file, temp_base_name)
|
253
|
-
Tempfile.new(temp_base_name, Technoweenie::AttachmentFu.tempfile_path).tap do |tmp|
|
253
|
+
Tempfile.new(temp_base_name, ::Technoweenie::AttachmentFu.tempfile_path).tap do |tmp|
|
254
254
|
tmp.close
|
255
255
|
FileUtils.cp file, tmp.path
|
256
256
|
end
|
@@ -258,7 +258,7 @@ module Technoweenie # :nodoc:
|
|
258
258
|
|
259
259
|
# Writes the given data to a new tempfile, returning the closed tempfile.
|
260
260
|
def write_to_temp_file(data, temp_base_name)
|
261
|
-
Tempfile.new(temp_base_name, Technoweenie::AttachmentFu.tempfile_path).tap do |tmp|
|
261
|
+
Tempfile.new(temp_base_name, ::Technoweenie::AttachmentFu.tempfile_path).tap do |tmp|
|
262
262
|
tmp.binmode
|
263
263
|
tmp.write data
|
264
264
|
tmp.close
|