runr (version 0.0.8)

proc_ruby: Run a Ruby process

Description

This function returns a list of functions to start/run/stop a Ruby process. The code is sent to Ruby via a socket connection, and the results are written back in another socket connection.

Usage

proc_ruby(port = 2000)

Arguments

port

A TCP port number

Value

A list of functions start(), exec(), running() (check if the process has been running), and stop().

Examples

Run this code
# NOT RUN {
rb = proc_ruby()
rb$start()
rb$exec("1 + 1")
rb$exec("a = 1..8", "a")  # return nothing
rb$exec("print a.inject(:+)")  # 36
rb$running()  # should be TRUE
rb$stop()
# }

Run the code above in your browser using DataLab