{"id":21656977,"url":"https://github.com/cotag/celluloid-promise","last_synced_at":"2025-10-11T01:39:26.147Z","repository":{"id":7541357,"uuid":"8893694","full_name":"cotag/celluloid-promise","owner":"cotag","description":"A promise/deferred implementation for Celluloid","archived":false,"fork":false,"pushed_at":"2013-04-06T01:03:18.000Z","size":136,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-07T14:21:49.735Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cotag.png","metadata":{"files":{"readme":"README.textile","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-20T01:30:15.000Z","updated_at":"2016-06-23T11:32:12.000Z","dependencies_parsed_at":"2022-09-13T12:14:02.117Z","dependency_job_id":null,"html_url":"https://github.com/cotag/celluloid-promise","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cotag/celluloid-promise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cotag%2Fcelluloid-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cotag%2Fcelluloid-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cotag%2Fcelluloid-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cotag%2Fcelluloid-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cotag","download_url":"https://codeload.github.com/cotag/celluloid-promise/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cotag%2Fcelluloid-promise/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005928,"owners_count":26083986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T09:18:34.278Z","updated_at":"2025-10-11T01:39:26.133Z","avatar_url":"https://github.com/cotag.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"h1. Celluloid Promise\n\n!https://secure.travis-ci.org/cotag/celluloid-promise.png(Build Status)!:https://travis-ci.org/cotag/celluloid-promise\n\nA promise / deferred implementation for Celluloid inspired by \"AngularJS\":http://docs.angularjs.org/api/ng.$q / \"Kris Kowal's Q.\":https://github.com/kriskowal/q\n\nFrom the perspective of dealing with error handling, deferred and promise apis are to asynchronous programing what try, catch and throw keywords are to synchronous programming.\n\n\u003cpre\u003e\u003ccode class=\"ruby\"\u003e\nrequire 'rubygems'\nrequire 'celluloid-promise'\n\ndef asyncGreet(name)\n\tdeferred = Celluloid::Q.defer\n\t\n\tThread.new do\n\t\tsleep 10\n\t\tdeferred.resolve(\"Hello #{name}\")\n\tend\n\t\n\tdeferred.promise\nend\n\n\nasyncGreet('Robin Hood').then(proc { |greeting|\n\tp \"Success: #{greeting}\"\n}, proc { |reason|\n\tp \"Failed: #{reason}\"\n})\n\nasyncGreet('The Dude').then do |greeting|\n\tp \"Jeff '#{greeting}' Lebowski\"\nend\n\n\n\u003c/code\u003e\u003c/pre\u003e\n\nAs that example is pretty terrible here is a decent write up on the \"uses for promises\":http://blog.jcoglan.com/2013/03/30/callbacks-are-imperative-promises-are-functional-nodes-biggest-missed-opportunity/\n\n\nh2. Start using it now\n\n# Read the \"Documentation\":http://rubydoc.info/gems/celluloid-promise/Celluloid/Promise\n# Then @gem install celluloid-promise@\n\n\nh2. Use case\n\nCelluloid provides a toolkit for building concurrent applications however coordinating complex chains of concurrent events can be difficult.\nCelluloid-Promise provides the following:\n\n* allows you to track a mash up of events across Actors\n* guarantees serial execution of callbacks\n* callback chains are spread across multiple threads\n** So multiple promise chains can be executed concurrently\n\nOf course passing blocks around is a fairly \"dangerous exercise\":https://github.com/celluloid/celluloid/wiki/Blocks#proposal-for-fixing-blocks, so do the following and you'll be safe\n\n* use Celluloid-Promise for flow control\n* resolve and reject promises with locally scoped variables\n* call Actor methods to change state or instance variables\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcotag%2Fcelluloid-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcotag%2Fcelluloid-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcotag%2Fcelluloid-promise/lists"}