Class: Nehm::TracksViewCommand
- Defined in:
- lib/nehm/tracks_view_command.rb
Overview
TracksViewCommand is a super class for all commands, that show tracks in list and let download selected tracks. When creating a new TracksViewCommand, define #get_tracks (protected), #initialize, #arguments, #program_name, #summary and #usage. You can also define #execute if you need, but you must place also ‘super’ in this inherited method
See ‘list_command.rb’ or ‘search_command.rb’ as example
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_LIMIT =
10
- DEFAULT_OFFSET =
0
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize ⇒ TracksViewCommand
constructor
A new instance of TracksViewCommand.
Methods inherited from Command
#add_option, #arguments, #handle_options, #invoke, #program_name, #summary, #usage
Constructor Details
#initialize ⇒ TracksViewCommand
Returns a new instance of TracksViewCommand.
18 19 20 |
# File 'lib/nehm/tracks_view_command.rb', line 18 def initialize super end |
Instance Method Details
#execute ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nehm/tracks_view_command.rb', line 22 def execute setup_environment old_offset = @offset @queue = [] @track_manager = TrackManager.new(@options) tracks = get_tracks UI.term 'There are no tracks yet' if tracks.nil? loop do # If offset changed, update list of tracks unless old_offset == @offset tracks = get_tracks old_offset = @offset end if tracks.nil? prev_page next end (tracks) end end |