Class: Mixtape::CLI
- Inherits:
-
Object
- Object
- Mixtape::CLI
- Defined in:
- lib/mixtape/cli.rb
Defined Under Namespace
Classes: InvalidSource
Instance Method Summary collapse
-
#initialize(source_name, number_of_songs) ⇒ CLI
constructor
A new instance of CLI.
- #open_playlist ⇒ Object
Constructor Details
#initialize(source_name, number_of_songs) ⇒ CLI
Returns a new instance of CLI.
5 6 7 8 9 10 |
# File 'lib/mixtape/cli.rb', line 5 def initialize(source_name, number_of_songs) source_constant = Mixtape::Source.const_get(source_name.capitalize) @source = source_constant.new(number_of_songs) @source_name = source_name rescue NameError; raise InvalidSource end |
Instance Method Details
#open_playlist ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/mixtape/cli.rb', line 12 def open_playlist system "echo 'Creating mixtape...'" playlist = Mixtape::YoutubePlaylist.new(@source.songs) launch = Thread.new { Launchy.open(playlist.url) } mixtape_animation = Thread.new { awesome_output } mixtape_animation.join launch.join end |