class Homophone::Formatter::ConsoleFormatter

Public Class Methods

new(opts = {}) click to toggle source
# File lib/homophone/formatter.rb, line 4
def initialize(opts = {})
  @show_genre = !!opts[:show_genre]
end

Public Instance Methods

format(artist) click to toggle source
# File lib/homophone/formatter.rb, line 8
def format(artist)
  if show_genre?
    "#{artist.name} (#{artist.genres.join(', ')})".sub(/ \(\)/, '')
  else
    artist.name
  end
end
show_genre?() click to toggle source
# File lib/homophone/formatter.rb, line 16
def show_genre?
  @show_genre
end