Method: PBM::AllCommands.load

Defined in:
lib/pbm/all_commands.rb

.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