Module: CodeRunner::InteractiveMethods

Defined in:
lib/coderunner/interactive_methods.rb

Constant Summary collapse

INTERACTIVE_METHODS =
<<EOF


include CodeRunner::InteractiveMethods
setup_interactive
module Kernel

		alias_method(:shell_do, "`".to_sym)
	def `(cmd)
		c =caller
		if c[0] =~ /irb_binding/
			system(cmd)
		else
			shell_do(cmd)
		end
	end
end
EOF

Instance Method Summary collapse

Instance Method Details

#cd(dirct) ⇒ Object



14
15
16
# File 'lib/coderunner/interactive_methods.rb', line 14

def cd(dirct)
	Dir.chdir(dirct)
end

#pwdObject



21
22
23
# File 'lib/coderunner/interactive_methods.rb', line 21

def pwd
	puts Dir.pwd
end

#runsObject



24
25
26
# File 'lib/coderunner/interactive_methods.rb', line 24

def runs
	CodeRunner.runner.run_list
end

#setup_interactiveObject



17
18
19
20
# File 'lib/coderunner/interactive_methods.rb', line 17

def setup_interactive
	@runner = CodeRunner.fetch_runner(CodeRunner::DEFAULT_COMMAND_OPTIONS.dup) unless CodeRunner::DEFAULT_COMMAND_OPTIONS[:q]
	@r = @runner
end

#upObject



10
11
12
13
# File 'lib/coderunner/interactive_methods.rb', line 10

def up
	ObjectSpace.each_object{|obj| obj.update if obj.class.to_s =~ /CodeRunner$/}
	nil
end