lib/knj/process_meta.rb in knjrbfw-0.0.29 vs lib/knj/process_meta.rb in knjrbfw-0.0.30
- old
+ new
@@ -1,10 +1,23 @@
require "#{$knjpath}process"
require "#{$knjpath}os"
+#This class can spawn another Ruby-process and manipulate it to create objects, evaluate code, create proxy-objects and other stuff in that process.
+#===Examples
+# This will create another Ruby-process, spawn an integer with the value of 5, run upto(10) and return each block to the current block. In the end the subprocess is terminated.
+# Knj::Process_meta.new do |subproc|
+# proxy_int = subproc.new(:Integer, 5)
+# proxy_int.upto(10) do |i|
+# print "Number: #{i}\n"
+# end
+# end
class Knj::Process_meta
attr_reader :process, :pid
+ #===Examples
+ #Knj::Process_meta.new("id" => "my_subproc") #Will make this ID be shown in the command, so you can recocknize it from "ps aux".
+ #Knj::Process_meta.new("exec_path" => "ruby1.9.1") #If you want a certain Ruby-command to be used when starting the subprocess, instead of detecting the current one.
+ #Knj::Process_meta.new("debug" => true, "debug_err" => true) #Enables various debug-messages to be printed.
def initialize(args = {})
@args = args
@objects = {}
#These variables are used to free memory in the subprocess, by using ObjectSpace#define_finalizer. The Mutex is the avoid problems when writing to the finalize-array multithreadded.
\ No newline at end of file