Sha256: 4e4bbd8b9466c3f5d36655883c12f98dd139db62fbf7c32377a5354113cc7187

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

require "open3"
require "io/wait"

module Textbringer
  module Commands
    include Utils

    @@command_list = []

    def self.list
      @@command_list
    end

    def define_command(name, &block)
      Commands.send(:define_method, name, &block)
      @@command_list << name if !@@command_list.include?(name)
    end
    module_function :define_command

    def undefine_command(name)
      if @@command_list.include?(name)
        Commands.send(:undef_method, name)
        @@command_list.delete(name)
      end
    end
    module_function :undefine_command
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
textbringer-0.1.7 lib/textbringer/commands.rb
textbringer-0.1.6 lib/textbringer/commands.rb
textbringer-0.1.5 lib/textbringer/commands.rb