Class: GetVersion::ExecutableStore

Inherits:
Object
  • Object
show all
Defined in:
lib/getversion/executable_store.rb

Instance Method Summary collapse

Constructor Details

#initializeExecutableStore

Returns a new instance of ExecutableStore.



6
7
8
# File 'lib/getversion/executable_store.rb', line 6

def initialize
  @executables = []
end

Instance Method Details

#add_executable(name, namespace, &block) ⇒ Object



10
11
12
# File 'lib/getversion/executable_store.rb', line 10

def add_executable(name, namespace, &block)
  @executables << Executable.new(name, namespace, &block)
end

#get_executable(name) ⇒ Object



14
15
16
17
# File 'lib/getversion/executable_store.rb', line 14

def get_executable(name)
  possibilities = [name, File.basename(name, '.*')]
  @executables.find { |e| possibilities.find { |p| p.casecmp(e.name) == 0 } }
end