Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactor next into if/elsif

  • Loading branch information...
commit 010e7cefda6b414208bd4aa45111e95111ea55f6 1 parent 0309f67
@eregon authored
Showing with 9 additions and 7 deletions.
  1. +9 −7 lib/suby.rb
View
16 lib/suby.rb
@@ -17,13 +17,15 @@ class << self
def download_subtitles(files, options = {})
files.each { |file|
file = Path(file)
- next download_subtitles(file.children, options) if file.dir?
- next if SUB_EXTENSIONS.include?(file.ext)
- next puts "Skipping: #{file}" if SUB_EXTENSIONS.any? { |ext|
- f = file.sub_ext(ext) and f.exist? and !f.empty?
- }
- next if file.exist? and !video?(file)
- download_subtitles_for_file(file, options)
+ if file.dir?
+ download_subtitles(file.children, options)
+ elsif SUB_EXTENSIONS.include?(file.ext)
+ # ignore already downloaded subtitles
+ elsif SUB_EXTENSIONS.any? { |ext| f = file.sub_ext(ext) and f.exist? and !f.empty? }
+ puts "Skipping: #{file}"
+ elsif !file.exist? or video?(file)
+ download_subtitles_for_file(file, options)
+ end
}
end
Please sign in to comment.
Something went wrong with that request. Please try again.