Class: Moviesort::Sorter::TV
- Inherits:
-
Object
- Object
- Moviesort::Sorter::TV
- Defined in:
- lib/moviesort/sorter.rb
Instance Method Summary collapse
-
#initialize(output_dir) ⇒ TV
constructor
A new instance of TV.
- #sort_file(path) ⇒ Object
Constructor Details
#initialize(output_dir) ⇒ TV
6 7 8 |
# File 'lib/moviesort/sorter.rb', line 6 def initialize(output_dir) @output_dir = output_dir end |
Instance Method Details
#sort_file(path) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/moviesort/sorter.rb', line 10 def sort_file(path) tv_show = Moviesort::TVShow.parse(File.basename(path)) target_path = File.join(@output_dir, tv_show.target_path) FileUtils.mkdir_p(target_path) FileUtils.mv(path, File.join(target_path, tv_show.target_filename)) end |