Sha256: fc1aca0db043be79ed37c70f04a0f84cca0ce63f3f70a26a64e4fcf61339a1c9

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

require '3llo/commands/list/list'
require '3llo/commands/list/cards'
require '3llo/commands/list/invalid'

module Tr3llo
  class ListCommandFactory
    def initialize(subcommand, args)
      @subcommand = subcommand
      @args = args
    end

    def factory
      case subcommand
      when 'list'
        board_id = $container.resolve(:board)[:id]
        Command::List::ListCommand.new(board_id)
      when 'cards'
        list_id, _ = args
        Command::List::CardsCommand.new(list_id)
      else
        Command::List::InvalidCommand.new
      end
    end

    private

    attr_reader :subcommand, :args
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
3llo-0.1.12 lib/3llo/list_command_factory.rb