• Stars
    star
    32
  • Rank 775,370 (Top 16 %)
  • Language
    Crystal
  • License
    MIT License
  • Created almost 8 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Promise Implementation in Crystal

Promise.cr Build Status GitHub release Crystal Docs

A Promise Implementation in Crystal.

Installation

Add promise to the shard.yml file as a dependency.

# shard.yml
dependencies:
  promise:
    github: jwaldrip/promise.cr
    tag: {desired_tag}

Usage

require "promise"
require "http/client"
require "json"

def read_body(response : HTTP::Client::Response) : String
  response.body
end

request = Promise(HTTP::Client::Response | JSON::Any).execute do |resolve|
  HTTP::Client.get "https://httpbin.org/user-agent"
end

puts "do something else...."

request.then do |response|
  JSON.parse(read_body(response as HTTP::Client::Response))
end.catch do |ex|
  puts "caught!"
  puts ex.message
end.then do |json_hash|
  puts json_hash
end.await

Documentation

You can generate docs using crystal doc on your local machine, or visit: https://jwaldrip.github.com/promise-cr to view the current version's documentation.

Contributing

See CONTRIBUTING

More Repositories

1

odin

A go-lang library to help build self documenting command line applications.
Go
246
star
2

admiral.cr

A robust DSL for writing command line interfaces written in Crystal.
Crystal
134
star
3

terraform-coreos-user-data

CoreOS cloud config generation via Terraform variables
HCL
46
star
4

git-get

Git clone that clones into a common path
Go
15
star
5

mime-types-cr

MIME Types for Crystal :: A port of the Ruby MIME::Types library
Crystal
10
star
6

shell-table.cr

Crystal
10
star
7

flatrack

A static site generator with a little sprinkle of ruby magic
Ruby
9
star
8

react-infinite-pane

Responsive infinite scroll pane for React
JavaScript
6
star
9

dotfiles

Jason Waldrip's Dev Environment
Makefile
6
star
10

crystal-sf2017

Crystal
6
star
11

stripe_rails

Ruby
5
star
12

tint

Go
3
star
13

http_cache_handler

Crystal
3
star
14

jasonwaldrip.com

My Little Website
CSS
3
star
15

graphql.cr

An implementation of GraphQL for Crystal
Crystal
3
star
16

of

A simple gem to give you n number of objects.
Ruby
3
star
17

workman

Define and run parallel workers in go
Go
2
star
18

navigable_hash

Ruby
2
star
19

modloc

Find the source location of a given module or class
Ruby
2
star
20

memory_model

A familar model construct that lives only when your app is running (Great for RSpec!)
Ruby
2
star
21

libgraphql-cr

Crystal
2
star
22

delegated_presenter

DelegatedPresenter, More info on rubydoc.info:
Ruby
1
star
23

docker-ruby-app

Shell
1
star
24

docker-mysql

Shell
1
star
25

docker-rails-app

Shell
1
star
26

docker-mariadb

Shell
1
star
27

faxfinder-override

CSS
1
star
28

docker-base

Shell
1
star
29

relay-vote

A voting app in relay.
JavaScript
1
star
30

docker-host

Ruby
1
star
31

docker-node

Shell
1
star
32

docker-rbenv

Shell
1
star
33

modernize-hashes

Ruby
1
star
34

jwaldrip.github.com

1
star
35

def_cache

Ruby
1
star
36

git-cleanremote

Clean up your remote repos
Ruby
1
star
37

node-docker-example

JavaScript
1
star
38

docker-docker

Shell
1
star
39

all_the_badges

Ruby
1
star
40

carly-paige

JavaScript
1
star
41

docker-railsdev

A feature full rails development environment.
1
star
42

concerned_inheritance

Ruby
1
star
43

pollr

Ruby
1
star
44

12f-elasticsearch

12 Factor Configurable Elasticsearch
Makefile
1
star
45

sinful-proxy

A Simple Proxy Written in Sinatra
Ruby
1
star
46

keep-em-up

Ruby
1
star
47

haml-flatrack

Ruby
1
star
48

homebrew-on-tap

Ruby
1
star
49

slim-flatrack

Slim for flatrack
1
star
50

12f-vault

Shell
1
star
51

tar.cr

Tape archives (tar) are a file format for storing a sequence of files that can be read and written in a streaming manner. This package aims to cover most variations of the format, including those produced by GNU and BSD tar tools.
Crystal
1
star