Sha256: 5608a168866f024da9d3cc98f586104823a3504f59a21d8069cd4d96175567ef

Contents?: true

Size: 877 Bytes

Versions: 6

Compression:

Stored size: 877 Bytes

Contents

module Tr3llo
  module Command
    module Card
      module List
        extend self

        def execute(board_id)
          lists_cards =
            get_lists(board_id)
              .map do |list|
                Thread.new { [list, get_cards(list.id)] }
              end
              .map { |thread| thread.join.value }

          interface = Application.fetch_interface!()

          interface.print_frame do
            interface.puts(
              lists_cards.map do |list, cards|
                View::Card::List.render(list, cards)
              end.join("\n\n\n")
            )
          end
        end

        private

        attr_reader :board_id

        def get_lists(board_id)
          API::List.find_all_by_board(board_id)
        end

        def get_cards(list_id)
          API::Card.find_all_by_list(list_id)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
3llo-1.3.1 lib/3llo/command/card/list.rb
3llo-1.3.1.pre.rc.0 lib/3llo/command/card/list.rb
3llo-1.2.0 lib/3llo/command/card/list.rb
3llo-1.1.0 lib/3llo/command/card/list.rb
3llo-1.0.0 lib/3llo/command/card/list.rb
3llo-1.0.0.pre.rc.0 lib/3llo/command/card/list.rb