Sha256: 7769e21e233262b8bb8d21ddc11b82450d8b40424809934a634f501d4711b525

Contents?: true

Size: 776 Bytes

Versions: 6

Compression:

Stored size: 776 Bytes

Contents

module Foobara
  class Command
    class << self
      def install!
        Namespace.global.foobara_add_category_for_subclass_of(:command, self)
      end

      def reset_all
        to_delete = []

        all.each do |command_class|
          if command_class.name.include?("::")
            parent_name = Util.parent_module_name_for(command_class.name)

            if Object.const_defined?(parent_name)
              command_class.undefine_command_named_function
            else
              to_delete << command_class
            end
          else
            command_class.undefine_command_named_function
          end
        end

        to_delete.each do |command_class|
          all.delete(command_class)
        end

        super
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foobara-0.0.38 projects/command/lib/foobara/command.rb
foobara-0.0.37 projects/command/lib/foobara/command.rb
foobara-0.0.36 projects/command/lib/foobara/command.rb
foobara-0.0.35 projects/command/lib/foobara/command.rb
foobara-0.0.34 projects/command/lib/foobara/command.rb
foobara-0.0.33 projects/command/lib/foobara/command.rb