class MusicMetaFixer::PrettyPrinter
Public Class Methods
new(options={})
click to toggle source
# File lib/music_meta_fixer/pretty_printer.rb, line 3 def initialize(options={}) end
Public Instance Methods
c()
click to toggle source
# File lib/music_meta_fixer/pretty_printer.rb, line 6 def c @c ||= Term::ANSIColor end
print_itunes_api_query(itunes_api)
click to toggle source
# File lib/music_meta_fixer/pretty_printer.rb, line 10 def print_itunes_api_query(itunes_api) puts "[#{c.blue 'INFO' }] Searching iTunes API with term '#{c.green itunes_api.term}' " \ "@ '#{c.green itunes_api.query}'" end
print_song_diff(song, compared_song, diff)
click to toggle source
# File lib/music_meta_fixer/pretty_printer.rb, line 15 def print_song_diff(song, compared_song, diff) current_info = c.bold("##### OLD #####\n") new_info = c.bold("##### NEW #####\n") song.instance_variables.each do |key| key = key.to_s.delete('@') sym_key = key.to_sym current_info_line = "#{key}: #{song.send(sym_key)}\n" new_info_line = "#{key}: #{compared_song.send(sym_key)}\n" current_info += diff.include?(sym_key) ? c.red("- " + current_info_line) : " " + current_info_line new_info += diff.include?(sym_key) ? c.green("+ " + new_info_line) : " " + new_info_line end puts current_info + new_info end