Class: BaseFinder
- Inherits:
-
Object
- Object
- BaseFinder
- Defined in:
- lib/script_finder/base_finder.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_BIN_DIR =
'script'
Instance Attribute Summary collapse
-
#bin_dir ⇒ Object
Returns the value of attribute bin_dir.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Class Method Summary collapse
Instance Method Summary collapse
- #execute_command ⇒ Object
-
#initialize(command, bin_dir = nil) ⇒ BaseFinder
constructor
A new instance of BaseFinder.
Constructor Details
#initialize(command, bin_dir = nil) ⇒ BaseFinder
Returns a new instance of BaseFinder.
20 21 22 23 |
# File 'lib/script_finder/base_finder.rb', line 20 def initialize(command, bin_dir = nil) @command = command self.bin_dir = bin_dir || DEFAULT_BIN_DIR end |
Instance Attribute Details
#bin_dir ⇒ Object
Returns the value of attribute bin_dir.
10 11 12 |
# File 'lib/script_finder/base_finder.rb', line 10 def bin_dir @bin_dir end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
11 12 13 |
# File 'lib/script_finder/base_finder.rb', line 11 def command @command end |
Class Method Details
.find_and_execute(command, bin_dir = nil) ⇒ Object
15 16 17 18 |
# File 'lib/script_finder/base_finder.rb', line 15 def self.find_and_execute(command, bin_dir = nil) command = command.split(' ') if command.is_a?(String) finder = new(command, bin_dir).execute_command end |
Instance Method Details
#execute_command ⇒ Object
25 26 27 |
# File 'lib/script_finder/base_finder.rb', line 25 def execute_command raise NotImplementedError.new("You must implement execute_command for subclasses of BaseFinder!") end |