Sha256: 8fb88c941b01ef50972aa0601d3cfca69ba0f1daab1fda02831057cd2512643b

Contents?: true

Size: 357 Bytes

Versions: 5

Compression:

Stored size: 357 Bytes

Contents

#!/usr/bin/env ruby

require "rubygems"
require "ruby_process"

Ruby_process.new.spawn_process do |rp|
  #Spawns string in the subprocess.
  str = rp.new(:String, "Kasper is 26 years old")
  
  #Scans with regex in subprocess, but yields proxy-objects in the current process.
  str.scan(/is (\d+) years old/) do |match|
    puts match.__rp_marshal
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby_process-0.0.9 examples/example_strscan.rb
ruby_process-0.0.8 examples/example_strscan.rb
ruby_process-0.0.7 examples/example_strscan.rb
ruby_process-0.0.5 examples/example_strscan.rb
ruby_process-0.0.4 examples/example_strscan.rb