RubyFlow The Ruby and Rails community linklog

return values from fork: fork_and_return

revert any side-effects like require or memory leaks and still get a result fork_and_return

Comments

gem install fork require ‘fork’ Fork.return { 1+1 } # => 2

I think it doesn’t get any simpler than that :D

oh, also if you don’t need the result immediately, the fork gem allows you to do: future = Fork.future { complex_calculation } # another complex calculation future.call # => result

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in