Class: CodeRunner::Cronos::CronosHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/cronoscrmod/cronos.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runner) ⇒ CronosHandler

Returns a new instance of CronosHandler.



55
56
57
58
59
# File 'lib/cronoscrmod/cronos.rb', line 55

def initialize(runner)
	if runner and runner.executable
		start_cronos(runner.executable)
	end
end

Instance Attribute Details

#cronosObject (readonly)

Returns the value of attribute cronos.



60
61
62
# File 'lib/cronoscrmod/cronos.rb', line 60

def cronos
  @cronos
end

Instance Method Details

#new_fileObject



73
74
75
# File 'lib/cronoscrmod/cronos.rb', line 73

def new_file
	@cronos.puts("zuicreate")
end

#restart_cronos(path) ⇒ Object



69
70
71
72
# File 'lib/cronoscrmod/cronos.rb', line 69

def restart_cronos(path)
	@cronos_started = false
	start_cronos(path)
end

#start_cronos(path) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/cronoscrmod/cronos.rb', line 62

def start_cronos(path)
	return if @cronos_started
	raise "cronos not found in #{path}" unless FileTest.exist?("#{path}/cronos.m")
	@cronos = IO.popen("#{path}/cronos 3>&2 2>&1 1>&3 | grep -v 'Time Machine' 3>&2 2>&1 1>&3 ",  'w')
	@cronos.puts("addpath('#{CodeRunner::Cronos.rcp.code_module_folder}/matlab')")
	@cronos_started = true
end