Sha256: 95161d81226ab306ce5d83e729bbe89dbaef181dec815c5cdb7330d13f3b295c

Contents?: true

Size: 435 Bytes

Versions: 3

Compression:

Stored size: 435 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 { fail 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.4 lib/balboa/cli/application.rb
balboa-0.1.3 lib/balboa/cli/application.rb
balboa-0.1.2 lib/balboa/cli/application.rb