Class: MooTool::ControllerBase

Inherits:
Object
  • Object
show all
Defined in:
lib/mootool/controller_base.rb

Overview

Controller base is the base class for all controllers that respond to command line requests.

Class Method Summary collapse

Class Method Details

.command(command = nil) ⇒ Object



26
27
28
29
# File 'lib/mootool/controller_base.rb', line 26

def command(command = nil)
  @command = command if command
  @command
end

.description(description) ⇒ Object



31
32
33
# File 'lib/mootool/controller_base.rb', line 31

def description(description)
  @description = description
end

.for_controller(name) ⇒ Object



16
17
18
# File 'lib/mootool/controller_base.rb', line 16

def self.for_controller(name)
  @@controllers.find { |c| c.command == name }
end

.inherited(child) ⇒ Object



20
21
22
23
# File 'lib/mootool/controller_base.rb', line 20

def self.inherited(child)
  @@controllers << child
  super
end

.load_allObject



10
11
12
13
14
# File 'lib/mootool/controller_base.rb', line 10

def self.load_all
  Dir.glob(File.join(CONTROLLERS_PATH, '*')).each do |file|
    require file
  end
end