0.0
No commit activity in last 3 years
No release in over 3 years
This is a toy tool to extend concurrency for objects.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

FocusActor

This is a toy tool to extend concurrency for objects.

Installation

Add this line to your application's Gemfile:

gem 'focus_actor'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install focus_actor

Usage

require 'focus_actor'

class User
  include FocusActor::Async
  include FocusActor::Future

  attr_reader :name, :age

  def initialize(name)
    @name = name
    @age = 0
  end

  def grow(cost = 0.1)
    sleep cost
    @age += 1
  end
end

user = User.new('Bob')
user.async.grow(1) # return nil, without block
future = user.future.grow(1) # return FutureCell
future.value