New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

async_rb

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async_rb

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Async

library of simple asynchronous utilities for ruby

Description

I've found myself using the same patterns fo adding lightweight concurrency and parallelism in my work. This gem is a port of those strategies to both centralize them and share them with others.

Installation

gem 'async_rb'

Usage

#####
# Async::Base - Add easy asynchronous processing of methods similar to Go or Celluloid
#####
class MyClass
  include Async::Base

  def say_hello
    puts "hello"
  end
end

obj = MyClass.new

# Run #say_hello synchronously
obj.say_hello
=> nil

# Run #say_hello asynchronously
obj.async(&:say_hello)
=> #<Thread:0x007fea3c8f5858 run> 


#####
# Async::Runner - Easily switch between Threads, Forks, and Synchronous processing with a common interface
#####
# Strategies include :thread, :fork, and :synchronous
# Defaults to :thread
runner = Async::Runner.new(:fork)
[
  runner.run { `rake db:migrate` },
  runner.run { `echo hello world` }
].each(&:join)

FAQs

Package last updated on 09 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc