Sha256: 662d0afff17d364761a36a543868cc34b0c10a5a300055e95d8cdeda97b9e509

Contents?: true

Size: 708 Bytes

Versions: 3

Compression:

Stored size: 708 Bytes

Contents

require 'default_logger'

# Maintain and run matlab commands and paths.
class MatlabQueue
  include DefaultLogger
  
  attr_accessor :paths, :commands, :ml_command
  attr_reader :success
  
  def initialize
    @paths = []
    @commands = []
    @ml_command = "matlab -nosplash -nodesktop"
    setup_logger
  end
  
  def to_s
    [
      @paths.flatten.collect {|path| "addpath(genpath('#{path}'))"},
      @commands
    ].flatten.join('; ')
  end
  
  def run!
    cmd = @ml_command + " -r \"#{ to_s }; exit\" "
    @success = run(cmd)
  end
  
  def method_missing(m, *args, &block)
    @commands.send(m, *args, &block)
  end
  
  def add_to_path(*args)
    args.each { |arg| @paths << arg }
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rpipe-0.0.3 lib/matlab_helpers/matlab_queue.rb
rpipe-0.0.2 lib/matlab_helpers/matlab_queue.rb
rpipe-0.0.1 lib/matlab_helpers/matlab_queue.rb