Skip to content

Commit 3be55fc

Browse files
committed
Clean up whitespace
1 parent 980c9b9 commit 3be55fc

25 files changed

+140
-146
lines changed

README.rdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ For example, assuming we had this definition:
138138
has_attached_file :scan, :styles => { :text => { :quality => :better } },
139139
:processors => [:rotator, :ocr]
140140

141-
then both the :rotator processor and the :ocr processor would receive the
141+
then both the :rotator processor and the :ocr processor would receive the
142142
options "{ :quality => :better }". This parameter may not mean anything to one
143143
or more or the processors, and they are expected to ignore it.
144144

Rakefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ task :manifest => :clean do
6262
puts file
6363
end
6464
end
65-
65+
6666
desc "Generate a gemspec file for GitHub"
6767
task :gemspec => :clean do
6868
File.open("#{spec.name}.gemspec", 'w') do |f|
6969
f.write spec.to_ruby
7070
end
71-
end
71+
end
7272

7373
desc "Build the gem into the current directory"
7474
task :gem => :gemspec do

generators/paperclip/USAGE

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Usage:
22

33
script/generate paperclip Class attachment1 (attachment2 ...)
4-
5-
This will create a migration that will add the proper columns to your class's table.
4+
5+
This will create a migration that will add the proper columns to your class's table.
+8-8
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
class PaperclipGenerator < Rails::Generator::NamedBase
22
attr_accessor :attachments, :migration_name
3-
3+
44
def initialize(args, options = {})
55
super
66
@class_name, @attachments = args[0], args[1..-1]
77
end
8-
9-
def manifest
8+
9+
def manifest
1010
file_name = generate_file_name
1111
@migration_name = file_name.camelize
1212
record do |m|
1313
m.migration_template "paperclip_migration.rb.erb",
1414
File.join('db', 'migrate'),
1515
:migration_file_name => file_name
1616
end
17-
end
18-
19-
private
20-
17+
end
18+
19+
private
20+
2121
def generate_file_name
2222
names = attachments.map{|a| a.underscore }
2323
names = names[0..-2] + ["and", names[-1]] if names.length > 1
2424
"add_attachments_#{names.join("_")}_to_#{@class_name.underscore}"
2525
end
26-
26+
2727
end

lib/paperclip.rb

+28-28
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ module Paperclip
5252

5353
class << self
5454
# Provides configurability to Paperclip. There are a number of options available, such as:
55-
# * whiny: Will raise an error if Paperclip cannot process thumbnails of
55+
# * whiny: Will raise an error if Paperclip cannot process thumbnails of
5656
# an uploaded image. Defaults to true.
5757
# * log: Logs progress to the Rails log. Uses ActiveRecord's logger, so honors
5858
# log levels, etc. Defaults to true.
5959
# * command_path: Defines the path at which to find the command line
60-
# programs if they are not visible to Rails the system's search path. Defaults to
60+
# programs if they are not visible to Rails the system's search path. Defaults to
6161
# nil, which uses the first executable found in the user's search path.
6262
# * image_magick_path: Deprecated alias of command_path.
6363
def options
@@ -100,7 +100,7 @@ def interpolates key, &block
100100
#
101101
# Paperclip.run("echo", "something", :expected_outcodes => [0,1,2,3])
102102
#
103-
# This method can log the command being run when
103+
# This method can log the command being run when
104104
# Paperclip.options[:log_command] is set to true (defaults to false). This
105105
# will only log if logging in general is set to true as well.
106106
def run cmd, *params
@@ -152,7 +152,7 @@ def processor name #:nodoc:
152152
name = name.to_s.camelize
153153
processor = Paperclip.const_get(name)
154154
unless processor.ancestors.include?(Paperclip::Processor)
155-
raise PaperclipError.new("Processor #{name} was not found")
155+
raise PaperclipError.new("Processor #{name} was not found")
156156
end
157157
processor
158158
end
@@ -194,41 +194,41 @@ class InfiniteInterpolationError < PaperclipError #:nodoc:
194194

195195
module ClassMethods
196196
# +has_attached_file+ gives the class it is called on an attribute that maps to a file. This
197-
# is typically a file stored somewhere on the filesystem and has been uploaded by a user.
197+
# is typically a file stored somewhere on the filesystem and has been uploaded by a user.
198198
# The attribute returns a Paperclip::Attachment object which handles the management of
199-
# that file. The intent is to make the attachment as much like a normal attribute. The
200-
# thumbnails will be created when the new file is assigned, but they will *not* be saved
201-
# until +save+ is called on the record. Likewise, if the attribute is set to +nil+ is
202-
# called on it, the attachment will *not* be deleted until +save+ is called. See the
203-
# Paperclip::Attachment documentation for more specifics. There are a number of options
199+
# that file. The intent is to make the attachment as much like a normal attribute. The
200+
# thumbnails will be created when the new file is assigned, but they will *not* be saved
201+
# until +save+ is called on the record. Likewise, if the attribute is set to +nil+ is
202+
# called on it, the attachment will *not* be deleted until +save+ is called. See the
203+
# Paperclip::Attachment documentation for more specifics. There are a number of options
204204
# you can set to change the behavior of a Paperclip attachment:
205205
# * +url+: The full URL of where the attachment is publically accessible. This can just
206206
# as easily point to a directory served directly through Apache as it can to an action
207207
# that can control permissions. You can specify the full domain and path, but usually
208-
# just an absolute path is sufficient. The leading slash *must* be included manually for
209-
# absolute paths. The default value is
208+
# just an absolute path is sufficient. The leading slash *must* be included manually for
209+
# absolute paths. The default value is
210210
# "/system/:attachment/:id/:style/:filename". See
211211
# Paperclip::Attachment#interpolate for more information on variable interpolaton.
212212
# :url => "/:class/:attachment/:id/:style_:filename"
213213
# :url => "http://some.other.host/stuff/:class/:id_:extension"
214-
# * +default_url+: The URL that will be returned if there is no attachment assigned.
215-
# This field is interpolated just as the url is. The default value is
214+
# * +default_url+: The URL that will be returned if there is no attachment assigned.
215+
# This field is interpolated just as the url is. The default value is
216216
# "/:attachment/:style/missing.png"
217217
# has_attached_file :avatar, :default_url => "/images/default_:style_avatar.png"
218218
# User.new.avatar_url(:small) # => "/images/default_small_avatar.png"
219-
# * +styles+: A hash of thumbnail styles and their geometries. You can find more about
220-
# geometry strings at the ImageMagick website
219+
# * +styles+: A hash of thumbnail styles and their geometries. You can find more about
220+
# geometry strings at the ImageMagick website
221221
# (http://www.imagemagick.org/script/command-line-options.php#resize). Paperclip
222-
# also adds the "#" option (e.g. "50x50#"), which will resize the image to fit maximally
223-
# inside the dimensions and then crop the rest off (weighted at the center). The
222+
# also adds the "#" option (e.g. "50x50#"), which will resize the image to fit maximally
223+
# inside the dimensions and then crop the rest off (weighted at the center). The
224224
# default value is to generate no thumbnails.
225-
# * +default_style+: The thumbnail style that will be used by default URLs.
225+
# * +default_style+: The thumbnail style that will be used by default URLs.
226226
# Defaults to +original+.
227227
# has_attached_file :avatar, :styles => { :normal => "100x100#" },
228228
# :default_style => :normal
229229
# user.avatar.url # => "/avatars/23/normal_me.png"
230230
# * +whiny+: Will raise an error if Paperclip cannot post_process an uploaded file due
231-
# to a command line error. This will override the global setting for this attachment.
231+
# to a command line error. This will override the global setting for this attachment.
232232
# Defaults to true. This option used to be called :whiny_thumbanils, but this is
233233
# deprecated.
234234
# * +convert_options+: When creating thumbnails, use this free-form options
@@ -324,19 +324,19 @@ def validates_attachment_thumbnails name, options = {}
324324
# * +unless+: Same as +if+ but validates if lambda or method returns false.
325325
def validates_attachment_presence name, options = {}
326326
message = options[:message] || "must be set."
327-
validates_presence_of :"#{name}_file_name",
327+
validates_presence_of :"#{name}_file_name",
328328
:message => message,
329329
:if => options[:if],
330330
:unless => options[:unless]
331331
end
332-
332+
333333
# Places ActiveRecord-style validations on the content type of the file
334-
# assigned. The possible options are:
335-
# * +content_type+: Allowed content types. Can be a single content type
336-
# or an array. Each type can be a String or a Regexp. It should be
337-
# noted that Internet Explorer upload files with content_types that you
338-
# may not expect. For example, JPEG images are given image/pjpeg and
339-
# PNGs are image/x-png, so keep that in mind when determining how you
334+
# assigned. The possible options are:
335+
# * +content_type+: Allowed content types. Can be a single content type
336+
# or an array. Each type can be a String or a Regexp. It should be
337+
# noted that Internet Explorer upload files with content_types that you
338+
# may not expect. For example, JPEG images are given image/pjpeg and
339+
# PNGs are image/x-png, so keep that in mind when determining how you
340340
# match. Allows all by default.
341341
# * +message+: The message to display when the uploaded file has an invalid
342342
# content type.

lib/paperclip/attachment.rb

+8-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Paperclip
44
# when the model saves, deletes when the model is destroyed, and processes
55
# the file upon assignment.
66
class Attachment
7-
7+
88
def self.default_options
99
@default_options ||= {
1010
:url => "/system/:attachment/:id/:style/:filename",
@@ -50,7 +50,7 @@ def initialize name, instance, options = {}
5050

5151
initialize_storage
5252
end
53-
53+
5454
def styles
5555
unless @normalized_styles
5656
@normalized_styles = {}
@@ -60,7 +60,7 @@ def styles
6060
end
6161
@normalized_styles
6262
end
63-
63+
6464
def processors
6565
@processors.respond_to?(:call) ? @processors.call(instance) : @processors
6666
end
@@ -69,7 +69,7 @@ def processors
6969
# errors, assigns attributes, and processes the file. It
7070
# also queues up the previous file for deletion, to be flushed away on
7171
# #save of its host. In addition to form uploads, you can also assign
72-
# another Paperclip attachment:
72+
# another Paperclip attachment:
7373
# new_user.avatar = old_user.avatar
7474
def assign uploaded_file
7575
ensure_required_accessors!
@@ -95,7 +95,7 @@ def assign uploaded_file
9595
@dirty = true
9696

9797
post_process
98-
98+
9999
# Reset the file size if the original file was reprocessed.
100100
instance_write(:file_size, @queued_for_write[:original].size.to_i)
101101
ensure
@@ -179,8 +179,8 @@ def size
179179
def content_type
180180
instance_read(:content_type)
181181
end
182-
183-
# Returns the last modified time of the file as originally assigned, and
182+
183+
# Returns the last modified time of the file as originally assigned, and
184184
# lives in the <attachment>_updated_at attribute of the model.
185185
def updated_at
186186
time = instance_read(:updated_at)
@@ -220,7 +220,7 @@ def reprocess!
220220
true
221221
end
222222
end
223-
223+
224224
# Returns true if a file has been assigned.
225225
def file?
226226
!original_filename.blank?
@@ -324,4 +324,3 @@ def flush_errors #:nodoc:
324324

325325
end
326326
end
327-

lib/paperclip/geometry.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ def inspect
7575
to_s
7676
end
7777

78-
# Returns the scaling and cropping geometries (in string-based ImageMagick format)
79-
# neccessary to transform this Geometry into the Geometry given. If crop is true,
80-
# then it is assumed the destination Geometry will be the exact final resolution.
81-
# In this case, the source Geometry is scaled so that an image containing the
82-
# destination Geometry would be completely filled by the source image, and any
83-
# overhanging image would be cropped. Useful for square thumbnail images. The cropping
78+
# Returns the scaling and cropping geometries (in string-based ImageMagick format)
79+
# neccessary to transform this Geometry into the Geometry given. If crop is true,
80+
# then it is assumed the destination Geometry will be the exact final resolution.
81+
# In this case, the source Geometry is scaled so that an image containing the
82+
# destination Geometry would be completely filled by the source image, and any
83+
# overhanging image would be cropped. Useful for square thumbnail images. The cropping
8484
# is weighted at the center of the Geometry.
8585
def transformation_to dst, crop = false
8686
if crop

lib/paperclip/interpolations.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def basename attachment, style_name
7878
# Returns the extension of the file. e.g. "jpg" for "file.jpg"
7979
# If the style has a format defined, it will return the format instead
8080
# of the actual extension.
81-
def extension attachment, style_name
81+
def extension attachment, style_name
8282
((style = attachment.styles[style_name]) && style[:format]) ||
8383
File.extname(attachment.original_filename).gsub(/^\.+/, "")
8484
end

lib/paperclip/iostream.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def stream_to path_or_file, in_blocks_of = 8192
2626
while self.read(in_blocks_of, buffer) do
2727
dstio.write(buffer)
2828
end
29-
dstio.rewind
29+
dstio.rewind
3030
dstio
3131
end
3232
end

lib/paperclip/matchers/validate_attachment_content_type_matcher.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def failure_message
4242
end
4343

4444
def negative_failure_message
45-
"Content types #{@allowed_types.join(", ")} should be rejected" +
45+
"Content types #{@allowed_types.join(", ")} should be rejected" +
4646
" and #{@rejected_types.join(", ")} accepted by #{@attachment_name}"
4747
end
4848

@@ -72,4 +72,3 @@ def rejected_types_rejected?
7272
end
7373
end
7474
end
75-

lib/paperclip/matchers/validate_attachment_presence_matcher.rb

-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,3 @@ def no_error_when_valid?
5252
end
5353
end
5454
end
55-

lib/paperclip/matchers/validate_attachment_size_matcher.rb

-1
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,3 @@ def higher_than_high?
9393
end
9494
end
9595
end
96-

lib/paperclip/processor.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Paperclip
66
#
77
# Processors are required to be defined inside the Paperclip module and
88
# are also required to be a subclass of Paperclip::Processor. There is
9-
# only one method you *must* implement to properly be a subclass:
9+
# only one method you *must* implement to properly be a subclass:
1010
# #make, but #initialize may also be of use. Both methods accept 3
1111
# arguments: the file that will be operated on (which is an instance of
1212
# File), a hash of options that were defined in has_attached_file's
@@ -33,7 +33,7 @@ def self.make file, options = {}, attachment = nil
3333
new(file, options, attachment).make
3434
end
3535
end
36-
36+
3737
# Due to how ImageMagick handles its image format conversion and how Tempfile
3838
# handles its naming scheme, it is necessary to override how Tempfile makes
3939
# its names so as to allow for file extensions. Idea taken from the comments

0 commit comments

Comments
 (0)