Class: SubtitleIt::Subwork

Inherits:
Object
  • Object
show all
Defined in:
lib/subtitle_it/bin.rb

Instance Method Summary collapse

Instance Method Details

#run!(file, format) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/subtitle_it/bin.rb', line 5

def run!(file, format)
  fail unless format
  content = File.open(file, 'r')
  puts "Working on file #{file}..."
  sub = Subtitle.new(dump: content, format: Bin.get_extension(file))
  dump = sub.send :"to_#{format}"
  Bin.write_out(Bin.swap_extension(file, format), dump)
end