Skip to content

Commit

Permalink
AO3-6625 Remove redundant assignment and prefer zero? to == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
sarken committed Oct 23, 2023
1 parent afdf8e1 commit 9d572e1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/models/download.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def file_type_from_mime(mime)
def file_name
name = clean(work.title)
extender = "Work_#{work.id}"
if name.length == 0
if name.length.zero?
name = extender
elsif name.length < 3
name += "_#{extender}"
Expand Down Expand Up @@ -139,7 +139,6 @@ def clean(string)
string = string.gsub(/ +/, " ")
string = string.strip
string = string.truncate(24, separator: ' ', omission: '')
string = string.gsub(/\s/, "_")
string
string.gsub(/\s/, "_")
end
end

0 comments on commit 9d572e1

Please sign in to comment.