Class: Miniflow::Tool
- Inherits:
-
Object
- Object
- Miniflow::Tool
- Includes:
- FileCheck
- Defined in:
- lib/miniflow/tool.rb
Overview
Burrow-Wheeler Aligner for short-read alignment.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Get tool options.
-
#available?(command) ⇒ Boolean
Use the version options to check if the command is available.
- #cmd ⇒ Object
-
#method_missing(name, *args) ⇒ Object
Calling the Ruby method executes a subcommand with the same name.
Methods included from FileCheck
check_file, check_file_exist, check_file_extname, mkdir_p
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
Calling the Ruby method executes a subcommand with the same name. Since the Ruby methods are called first, care must be taken to avoid name collisions. For example, subcommands such as ‘call` need to be redefined.
47 48 49 |
# File 'lib/miniflow/tool.rb', line 47 def method_missing(name, *args) cmd.run2(@command, name, *args) end |
Instance Method Details
#[](key) ⇒ Object
Get tool options
35 36 37 |
# File 'lib/miniflow/tool.rb', line 35 def [](key) @options[key] end |
#available?(command) ⇒ Boolean
Use the version options to check if the command is available
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/miniflow/tool.rb', line 12 def available?(command) # puts Pastel.new.magenta("Check #{self.class.name}") pastel = Pastel.new class_name = self.class.name.split('::').last begin result = cmd.run!(command) rescue Errno::ENOENT => e pastel = Pastel.new msg = "\n" \ "Please make sure that the #{class_name} is available.\n\n" e. << msg raise e end if result.failure? msg = "The exit status of #{command} is not zero.\n" \ "Please make sure that the #{command} is available.\n\n" raise Errno::ENOENT, msg # FIXME else puts pastel.green.bold("✔ #{class_name}") end end |
#cmd ⇒ Object
39 40 41 |
# File 'lib/miniflow/tool.rb', line 39 def cmd TTYCMD end |