Sha256: 5acc08298714ed935d2add89da89731b687f5e6a3dea3da90097804345726fe7

Contents?: true

Size: 866 Bytes

Versions: 1

Compression:

Stored size: 866 Bytes

Contents

module Troo
  module Presenters
    class List
      include DecoratorHelpers

      def initialize(list, options = {})
        @list, @options = list, options
      end

      def show
        output.render list.board.title
        output.render "\n"

        output.indent do
          output.render list.title

          output.indent do
            if cards.empty?
              output.render error('No cards were found.') + "\n"
            else
              print_list_with_cards
            end
          end
        end
      end

      private

      attr_reader :list

      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.cards
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.9 lib/troo/presenters/list.rb