Class: GetVersion::ExecutableStore
- Inherits:
-
Object
- Object
- GetVersion::ExecutableStore
- Defined in:
- lib/getversion/executable_store.rb
Instance Method Summary collapse
- #add_executable(name, namespace, &block) ⇒ Object
- #get_executable(name) ⇒ Object
-
#initialize ⇒ ExecutableStore
constructor
A new instance of ExecutableStore.
Constructor Details
#initialize ⇒ ExecutableStore
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 |