Class: PBM::AllCommands

Inherits:
Object
  • Object
show all
Defined in:
lib/pbm/all_commands.rb

Class Method Summary collapse

Class Method Details

.load(interpreter) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/pbm/all_commands.rb', line 4

def load(interpreter)
  Hash[Dir[File.dirname(__FILE__) + '/commands/*.rb'].map do |file|
    require file
    command = file.split('/').last.split('.').first
    class_name = "PBM::Commands::#{command.capitalize}"
    [command.to_sym, Object.const_get(class_name).new(interpreter)]
  end]
end