Module: CodeRunner::InteractiveMethods

Defined in:
lib/coderunner/interactive_methods.rb

Constant Summary collapse

INTERACTIVE_METHODS =
"\n\ninclude CodeRunner::InteractiveMethods\nsetup_interactive\nmodule Kernel\n\n    alias_method(:shell_do, \"`\".to_sym)\n  def `(cmd)\n    c =caller\n    if c[0] =~ /irb_binding/\n      system(cmd)\n    else\n      shell_do(cmd)\n    end\n  end\nend\n"

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