class YoutubeDL::Command
Public Class Methods
new(url, **options)
click to toggle source
# File lib/youtube_dl/command.rb, line 21 def initialize(url, **options) @url = url @options = config.default_options .merge(options) .merge(config.forced_options) end
Public Instance Methods
arguments()
click to toggle source
# File lib/youtube_dl/command.rb, line 29 def arguments @options.flat_map do |option, value| option = option.to_s.gsub('_', '-') case value when [] then nil when true then "--#{option}" when false then "--no-#{option}" else ["--#{option}", value] end end end
config()
click to toggle source
# File lib/youtube_dl/command.rb, line 8 def config self.class.config end
to_a()
click to toggle source
# File lib/youtube_dl/command.rb, line 41 def to_a [config.executable] + arguments + [@url] end
to_s()
click to toggle source
# File lib/youtube_dl/command.rb, line 45 def to_s Shellwords.join(to_a) end