lib/troo/presenters/list.rb in troo-0.0.8 vs lib/troo/presenters/list.rb in troo-0.0.9

- old
+ new

@@ -1,44 +1,48 @@ module Troo module Presenters class List include DecoratorHelpers - class << self - def show(list, options = {}) - new(list, options).show - end - end - def initialize(list, options = {}) - @list = list - @options = options + @list, @options = list, options end def show - puts board.decorator.title + output.render list.board.title + output.render "\n" - title_for(list.decorator) + output.indent do + output.render list.title - print_error 'No cards were found.' if cards.empty? - - cards.each do |card| - title_for(card) + output.indent do + if cards.empty? + output.render error('No cards were found.') + "\n" + else + print_list_with_cards + end + end end - - puts end private attr_reader :list - def board - list.board + def output + @output ||= Troo::Output.new end + def print_list_with_cards + output.render "\n" + cards.each do |card| + output.render card.title + end + nil + end + def cards - list.decorator.cards + list.cards end end end end