lib/groove-dl/displayer.rb in groove-dl-0.2.0 vs lib/groove-dl/displayer.rb in groove-dl-0.3.0
- old
+ new
@@ -5,12 +5,12 @@
attr_reader :result, :type
##
# Initialize Displayer
#
- # @params [Array] result The result from the search
- # @params [String] type The search type
+ # @param [Array] result The result from the search
+ # @param [String] type The search type
#
# @return [Nil]
#
def initialize(result, type)
@result = result
@@ -29,25 +29,25 @@
puts table.to_s
end
def headers
return %w(Id Album Artist Song) if @type == 'Songs'
- return %w(Id Nam Author NumSongs) if @type == 'Playlists'
+ return %w(Id Name Author NumSongs) if @type == 'Playlists'
end
##
# Add row into table
#
- # @params [Terminal::Table] table Table in which row will be added
- # @params [Array] result The result from the search
+ # @param [Terminal::Table] table Table in which row will be added
+ # @param [Array] result The result from the search
#
# @return [Nil]
#
def add_row(table, data)
- table.add_row([data['playlist_id'],
- data['name'],
- data['f_name'],
- data['num_songs']]) if @type == 'Playlists'
+ table.add_row([data.id,
+ data.name,
+ data.username,
+ data.num_songs]) if @type == 'Playlists'
table.add_row([data.id,
data.album,
data.artist,
data.name]) if @type == 'Songs'
end