Class: MatlabQueue
- Inherits:
-
Object
- Object
- MatlabQueue
- Includes:
- DefaultLogger
- Defined in:
- lib/matlab_helpers/matlab_queue.rb
Overview
Maintain and run matlab commands and paths.
Instance Attribute Summary collapse
-
#commands ⇒ Object
Returns the value of attribute commands.
-
#ml_command ⇒ Object
Returns the value of attribute ml_command.
-
#paths ⇒ Object
Returns the value of attribute paths.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
Instance Method Summary collapse
-
#add_to_path(*args) ⇒ Object
Add paths that should be available for Matlab scripts.
-
#initialize ⇒ MatlabQueue
constructor
A new instance of MatlabQueue.
- #method_missing(m, *args, &block) ⇒ Object
- #run! ⇒ Object
- #to_s ⇒ Object
Methods included from DefaultLogger
Constructor Details
#initialize ⇒ MatlabQueue
Returns a new instance of MatlabQueue.
11 12 13 14 15 16 |
# File 'lib/matlab_helpers/matlab_queue.rb', line 11 def initialize @paths = [] @commands = [] @ml_command = "matlab -nosplash -nodesktop" setup_logger unless defined?($Log) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
28 29 30 |
# File 'lib/matlab_helpers/matlab_queue.rb', line 28 def method_missing(m, *args, &block) @commands.send(m, *args, &block) end |
Instance Attribute Details
#commands ⇒ Object
Returns the value of attribute commands.
8 9 10 |
# File 'lib/matlab_helpers/matlab_queue.rb', line 8 def commands @commands end |
#ml_command ⇒ Object
Returns the value of attribute ml_command.
8 9 10 |
# File 'lib/matlab_helpers/matlab_queue.rb', line 8 def ml_command @ml_command end |
#paths ⇒ Object
Returns the value of attribute paths.
8 9 10 |
# File 'lib/matlab_helpers/matlab_queue.rb', line 8 def paths @paths end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
9 10 11 |
# File 'lib/matlab_helpers/matlab_queue.rb', line 9 def success @success end |
Instance Method Details
#add_to_path(*args) ⇒ Object
Add paths that should be available for Matlab scripts.
33 34 35 |
# File 'lib/matlab_helpers/matlab_queue.rb', line 33 def add_to_path(*args) args.each { |arg| @paths << arg } end |
#run! ⇒ Object
22 23 24 25 26 |
# File 'lib/matlab_helpers/matlab_queue.rb', line 22 def run! set_matlabpath cmd = @ml_command + " -r \"#{ escape_error(to_s) }, exit\" " @success = run(cmd) end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/matlab_helpers/matlab_queue.rb', line 18 def to_s @commands.flatten.join(', ') end |