Sha256: 780930edeab8db3f41c655dbe82f3ab1ba2795e7d472d72d7f7d1ab510405a0a

Contents?: true

Size: 536 Bytes

Versions: 1

Compression:

Stored size: 536 Bytes

Contents

# frozen_string_literal: true

module TooDoo
  # Application is the entry point for the app
  # it takes arguments and passes them to a command
  # to spin up the corresponding logic
  class Application
    attr_reader :args, :command

    def initialize(args = Arguments.new)
      @args = args
      @command = recognize_command
    end

    def run!
      command.new(@args.argument).run!
    end

    private

    def recognize_command
      Commands::COMMANDS.fetch \
        @args.command.to_sym, Commands::Help
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
toodoo-0.1.1 lib/toodoo/application.rb