Sha256: 0f9b2e7874ba61fd997eb0b50806ea37687f83c4a68ea01f3a95a3c113a72c48

Contents?: true

Size: 436 Bytes

Versions: 3

Compression:

Stored size: 436 Bytes

Contents

# frozen_string_literal: true

module Balboa
  module CLI
    class Application
      CommandNotFound = Class.new(RuntimeError)

      def initialize(command_id)
        @command_id = command_id.to_s
        @commands = Hash.new { raise CommandNotFound }
      end

      def add_command(key, command)
        @commands[key.to_s] = command
      end

      def execute
        @commands[@command_id].execute
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
balboa-0.1.7 lib/balboa/cli/application.rb
balboa-0.1.6 lib/balboa/cli/application.rb
balboa-0.1.5 lib/balboa/cli/application.rb