Sha256: 8e2a3a827376a10d556cf0910ede33b5455ccb4ae416dab2856c221ac2f9af5a

Contents?: true

Size: 450 Bytes

Versions: 4

Compression:

Stored size: 450 Bytes

Contents

module Kommand
  module Commands
    def self.commands
      @commands ||= []
    end

    def self.exists?(cmd)
      commands.map(&:command_name).include?(cmd.underscore.to_s)
    end

    def self.command(cmd)
      raise "Command does not exist: #{cmd}" unless exists?(cmd)
      commands.select { |command| command.command_name == cmd.underscore.to_s }.first
    end
  end
end

require 'kommand/commands/command'
require 'kommand/commands/help'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kommand-0.0.4 lib/kommand/commands.rb
kommand-0.0.3 lib/kommand/commands.rb
kommand-0.0.2 lib/kommand/commands.rb
kommand-0.0.1 lib/kommand/commands.rb