Sha256: db35c27550d6aaa724b013c6017875cf329a0501746d539303b638be93ba31ef
Contents?: true
Size: 773 Bytes
Versions: 8
Compression:
Stored size: 773 Bytes
Contents
# frozen_string_literal: true CONTROLLERS_PATH = File.join(File.dirname(__FILE__), 'controllers') module MooTool # Controller base is the base class for all controllers that respond to command line requests. class ControllerBase @controllers = [] def self.load_all Dir.glob(File.join(CONTROLLERS_PATH, '*')).each do |file| require file end end def self.for_controller(name) @@controllers.find { |c| c.command == name } end def self.inherited(child) @@controllers << child super end class << self def command(command = nil) @command = command if command @command end def description(description) @description = description end end end end
Version data entries
8 entries across 8 versions & 1 rubygems